This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Check whether symbolic array elements are NaNs




isnan(A) returns an array of the same size as A containing logical 1s (true) where the elements of A are symbolic NaNs, and logical 0s (false) where they are not.


Determine Which Elements of Symbolic Array Are NaNs

Using isnan, determine which elements of this symbolic matrix are NaNs:

isnan(sym([pi NaN Inf; 1 + i Inf + i NaN + i]))
ans =
  2×3 logical array
     0     1     0
     0     0     1

Input Arguments

collapse all

Input value, specified as a symbolic number, variable, expression, or function, or as an array, vector, or matrix of symbolic numbers, variables, expressions, functions.

More About

collapse all


  • For any A, exactly one of the three quantities isfinite(A), isinf(A), or isnan(A) is 1 for each element.

  • Symbolic expressions and functions containing NaN evaluate to NaN. For example, sym(NaN + i) returns symbolic NaN.

Introduced in R2013b

Was this topic helpful?