MATLAB Function Reference |

Detect `NaN`

elements of an array

**Syntax**

**Description**

```
TF = isnan(A)
```

returns an array the same size as `A`

containing logical true (`1`

) where the elements of `A`

are `NaN`

s and logical false (`0`

) where they are not.

For any 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) Warning: Divide by zero. ans = 0 0 0 0 0 isnan(0./a) Warning: Divide by zero. ans = 0 0 1 0 0

**See Also**

ismethod (COM) | isnumeric |