Create array of all NaN
values
X = NaN
returns the scalar representation of
"not a number". Operations return NaN
when they have undefined numeric
results, such as 0/0
or 0*Inf
.
X = NaN(
returns an
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.
X = NaN(___,
returns an
array of typename
)NaN
values of data type typename
, which can
be either 'single'
or 'double'
.
X = NaN
returns the scalar, type double
,
IEEE® representation of "not a number". The exact bit-wise hexadecimal
representation of this value is fff8000000000000
. MATLAB® preserves the "not a number" status of alternate NaN
representations 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 canonical NaN
bit pattern
previously described.
NaN
values are not equal to each other. As a result, comparison
operations involving NaN
return false, except for the not equal
operator ~=
. For example, NaN == NaN
returns logical
0 (false
) but NaN ~= NaN
returns logical 1
(true
).
NaN
values 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 isnan
or ismissing
function to detect
NaN
values in an array. The rmmissing
function
detects and removes NaN
values, and the fillmissing
function detects NaN
values and replaces them with
non-NaN
values.