nanstd
(Not recommended) Standard deviation, ignoring NaN
values
nanstd
is not recommended. Use the MATLAB® function std
instead. With the std
function, you can specify whether
to include or omit NaN
values for the calculation. For more information,
see Version History.
Syntax
Description
is the
standard deviation y
= nanstd(X
)std
of X
, computed after
removing all NaN
values.
If
X
is a vector, thennanstd(X)
is the sample standard deviation of all the non-NaN
elements ofX
.If
X
is a matrix, thennanstd(X)
is a row vector of column sample standard deviations, computed after removingNaN
values.If
X
is a multidimensional array, thennanstd
operates along the first nonsingleton dimension ofX
. The size of this dimension becomes 1 while the sizes of all other dimensions remain the same.nanstd
removes allNaN
values.By default,
nanstd
normalizesy
by n – 1, where n is the number of remaining observations after removing observations withNaN
values.
returns the standard deviation over the dimensions specified in the vector
y
= nanstd(X
,flag
,vecdim
)vecdim
. The function computes the standard deviations after removing
NaN
values. For example, if X
is a matrix, then
nanstd(X,0,[1 2])
is the sample standard deviation of all
non-NaN
elements of X
because every element of a
matrix is contained in the array slice defined by dimensions 1 and 2.