nanmean
Computes mean values, ignoring NaN values.
Syntax
m = nanmean(x)
m = nanmean(x,dim)
Inputs
- x
- Data sample.
- dim
- Dimension on which to perform the calculation.
Outputs
- m
- Mean.
Examples
Vector example:
x = [9.3, 10.6, nan, 11.9, 13.3, nan, 15.1, 18.2];
m = nanmean(x)
m = 13.0666667
Matrix example:
x = [9.3, 4.8; 10.6, 6.6; 11.9, 8.0; 13.3, 9.3; 15.1, 10.6; nan, nan; 18.2, 11.9];
m = nanmean(x)
m = [Matrix] 1 x 2
13.06667 8.53333