ISNAN Test for Not-a-Numbers

Section: Inspection Functions


Returns true for entries of an array that are NaN's (i.e., Not-a-Numbers). The usage is
   y = isnan(x)

The result is a logical array of the same size as x, which is true if x is not-a-number, and false otherwise. Note that for complex data types that the result is true if either the real or imaginary parts are NaNs.


Suppose we have an array of floats with one element that is nan:
--> a = [1.2 3.4 nan 5]

a = 
    1.2000    3.4000 NaN    5.0000 

--> isnan(a)

ans = 
 0 0 1 0