| Statistics Toolbox | ![]() |
Syntax
y = nansum(X)
Description
y = nansum is the sum computed by treating (X)
NaNs as missing values.
For vectors, nansum(x) is the sum of the non-NaN elements of x. For matrices, nansum(X) is a row vector containing the sum of the non-NaN elements in each column of X.
Example
m = magic(3);m([1 6 8]) = [NaN NaN NaN]m =NaN 1 63 5 NaN4 NaN 2nsum = nansum(m)nsum =7 6 8
See Also
nanmax, nanmin, nanmean, nanmedian, nanstd
| nanstd | nbincdf | ![]() |