Main Content

isnat

Determine NaT (Not-a-Time) elements

Description

example

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

Examples

collapse all

Create a datetime array from numeric values containing NaN.

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

Determine if any elements of d are NaT (Not-a-Time).

isnat(d)
ans = 1x4 logical array

   0   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™.

Version History

Introduced in R2014b

See Also

|