| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Statistics Toolbox |
| Contents | Index |
| Learn more about Statistics Toolbox |
y = nanstd(X)
y
= nanstd(X,1)
y = nanstd(X,flag,dim)
y = nanstd(X) is the standard deviation std of X, computed after removing NaN values.
For vectors x, nanstd(x) is the sample standard deviation of the remaining elements, once NaN values are removed. For matrices X, nanstd(X) is a row vector of column sample standard deviations, once NaN values are removed. For multidimensional arrays X, nanstd operates along the first nonsingleton dimension.
If n is the number of remaining observations after removing observations with NaN values, nanstd normalizes y by n – 1. To specify normalization by n, use y = nanstd(X,1).
y = nanstd(X,flag,dim) takes the standard deviation along the dimension dim of X. The flag is 0 or 1 to specify normalization by n – 1 or n, respectively, where n is the number of remaining observations after removing observations with NaN values.
Find column standard deviations for data with missing values:
X = magic(3);
X([1 6:9]) = repmat(NaN,1,5)
X =
NaN 1 NaN
3 5 NaN
4 NaN NaN
y = nanstd(X)
y =
0.7071 2.8284 NaN![]() | nanmin | nansum | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |