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
Xis a vector, thennanstd(X)is the sample standard deviation of all the non-NaNelements ofX.If
Xis a matrix, thennanstd(X)is a row vector of column sample standard deviations, computed after removingNaNvalues.If
Xis a multidimensional array, thennanstdoperates along the first nonsingleton dimension ofX. The size of this dimension becomes 1 while the sizes of all other dimensions remain the same.nanstdremoves allNaNvalues.By default,
nanstdnormalizesyby n – 1, where n is the number of remaining observations after removing observations withNaNvalues.
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.
