FORMAT: Y = NANSUM(X,DIM)
Sum of values ignoring NaNs
This function enhances the functionality of NANSUM as distributed in the MATLAB Statistics Toolbox and is meant as a replacement (hence the identical name).
NANSUM(X,DIM) calculates the mean along any dimension of the N-D array X ignoring NaNs. If DIM is omitted NANSUM averages along the first non-singleton dimension of X.
Similar replacements exist for NANMEAN, NANSTD, NANMEDIAN, NANMIN, and NANMAX which are all part of the NaN-suite.
Syntax
y = nansum(x,dim)