cumsum

Syntax

cumsum(X)

Please see Cumulative Window Functions (cum-functions) for the parameters and windowing logic.

Details

Cumulatively calculate the sum of the elements in X.

Examples

$ x=[2,3,4];
$ cumsum(x);
[2,5,9]

$ m=matrix(1 2 3, 4 5 6);
$ m;

#0

#1

1

4

2

5

3

6

$ cumsum(m);

#0

#1

1

4

3

9

6

15

Related functions: cummax, cummin, cumprod, cumPositiveStreak, cumsum2, cumsum3