Main Content

isnat

Determine NaT (Not-a-Time) elements

Syntax

Description

example

tf = isnat(A)returns an array the same size as the datetime array,A, containing logical 1 (true) where the elements ofAare Not-a-Time (NaTs) and logical 0 (false) where they are not.NaTrepresents a datetime that is undefined.

Examples

collapse all

Create a datetime array from numeric values containingNaN.

d = datetime(2014,[1 2 NaN 4],1)
d =1x4 datetime01-Jan-2014 01-Feb-2014 NaT 01-Apr-2014

Determine if any elements ofdareNaT(Not-a-Time).

isnat(d)
ans =1x4 logical array0 0 1 0

Input Arguments

collapse all

Input array, specified as a datetime array.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

See Also

|

Introduced in R2014b