NaN
Create array of all NaN values
Description
returns the
scalar representation of "not a number". Operations return X = NaNNaN when
they have undefined numeric results, such as 0/0 or
0*Inf.
returns an X = NaN(sz1,...,szN)sz1-by-...-by-szN array of
NaN values, where sz1,...,szN indicate the size of
each dimension. For example, NaN(3,4) returns a 3-by-4 matrix.
Examples
Input Arguments
Output Arguments
Tips
X = NaNreturns the scalar, typedouble, IEEE® representation of "not a number". The exact bit-wise hexadecimal representation of this value isfff8000000000000. MATLAB® preserves the "not a number" status of alternateNaNrepresentations and treats all representations equivalently. In some special cases, due to hardware limitations for example, MATLAB does not preserve the exact bit pattern of the alternate representations during computation, and instead uses the canonicalNaNbit pattern previously described.NaNvalues are not equal to each other. As a result, comparison operations involvingNaNreturn false, except for the not equal operator~=. For example,NaN == NaNreturns logical 0 (false), butNaN ~= NaNreturns logical 1 (true).NaNvalues in a vector are treated as different unique elements. For example,unique([1 1 NaN NaN])returns the row vector[1 NaN NaN].Use the
isnanorismissingfunction to detectNaNvalues in an array. Use theanynanoranymissingfunction to determine if any array element isNaN. Use thermmissingfunction to detect and removeNaNvalues, and thefillmissingfunction to detectNaNvalues and replace them with non-NaNvalues.
Extended Capabilities
Version History
Introduced before R2006a