Skip to Main Content Skip to Search
Product Documentation

isnan - Array elements that are NaN

Syntax

TF = isnan(A)

Description

TF = isnan(A) returns an array the same size as A containing logical 1 (true) where the elements of A are NaNs and logical 0 (false) where they are not. For a complex number z, isnan(z) returns 1 if either the real or imaginary part of z is NaN, and 0 if both the real and imaginary parts are finite or Inf.

For any real A, exactly one of the three quantities isfinite(A), isinf(A), and isnan(A) is equal to one.

Examples

A = [-2  -1  0  1  2];

isnan(1./A)
ans =
     0     0     0     0     0

isnan(0./A)
ans =
     0     0     1     0     0

See Also

is* | isfinite | isinf

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS