Function Reference: nansum

statistics: s = nansum (x)
statistics: s = nansum (x, dim)
statistics: s = nansum (…, "native")
statistics: s = nansum (…, "double")
statistics: s = nansum (…, "extra")

Compute the sum while ignoring NaN values.

nansum is identical to the sum function except that NaN values are treated as 0 and so ignored. If all values are NaN, the sum is returned as 0.

See help text of sum for details on the options.

See also: sum, nanmin, nanmax

Source Code: nansum