Products & Services Industries Academia Support User Community Company

Learn more about Financial Toolbox   

nansum - Sum ignoring NaNs

Syntax

y = nansum(X)
y = nansum(X,DIM)

Arguments

X

Financial time series object.

DIM

Dimension along which the operation is conducted.

Description

nansum for financial times series objects is based on the Statistics Toolbox function nansum. See nansum in the Statistics Toolbox documentation.

y = nansum(X) returns the sum of a financial time series object X, treating NaNs as missing values. y is the sum of the non-NaN elements in X.

y = nansum(X,DIM) takes the sum along dimension DIM of X.

Examples

To compute nansum for the following dates:

dates = {'01-Jan-2007';'02-Jan-2007';'03-Jan-2007'};
f = fints(dates, magic(3));
f.series1(1) = nan;
f.series2(3) = nan;
f.series3(2) = nan;

nsum = nansum(f)

nsum =
     7     6     8

See Also

nanmax, nanmean, nanmedian, nanmin, nanstd, nanvar

  


Free Interactive Computational Finance CD

View demos and recorded presentations led by industry experts.

Now On Demand
Network with industry peers and learn the latest applications of the leading software product for computational finance.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS