nanstd

Compute standard deviations, ignoring NaN values.

Syntax

s = nanstd(x)

s = nanstd(x,scale)

s = nanstd(x,scale,dim)

Inputs

x
Data sample.
Type: double
Dimension: vector | matrix
scale
Scale option.
Type: integer
Use scale=0 (default) to divide by n-1, and scale=1 to divide by n, where n is the number of samples in each data vector.
Dimension: integer
dim
Dimension on which to perform the calculation.
Default: first non-singleton dimension.
Type: integer
Dimension: scalar

Outputs

s
Standard deviation.
Dimension: scalar | matrix

Examples

Vector example:
x = [9.3, 10.6, nan, 11.9, 13.3, nan, 15.1, 18.2];
s = nanstd(x)
s = 3.23027347
Matrix example:
x = [9.3, 4.8; 10.6, 6.6; nan, nan; 11.9, 8.0; 13.3, 9.3; 15.1, 10.6; 18.2, 11.9];
s = nanstd(x)
s = [Matrix] 1 x 2
3.23027  2.61355