next up previous contents
Next: ISINF Test for infinities Up: Inspection Functions Previous: ISSPARSE Test for Sparse   Contents

Subsections

ISNAN Test for Not-a-Numbers

Usage

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 or dcomplex data types that the result is true if either the real or imaginary parts are NaNs.

Example

Suppose we have an array of floats with one element that is nan:

--> a = [1.2 3.4 nan 5]
a = 
  <double>  - size: [1 4]
 
Columns 1 to 2
    1.200000000000000         3.400000000000000      
 
Columns 3 to 4
    nan                       5.000000000000000      
--> isnan(a)
ans = 
  <logical>  - size: [1 4]
 
Columns 1 to 4
 0  0  1  0



Samit K. Basu 2005-03-16