cumsum
The cumulative sum of an object's elements along a specified dimension.
Syntax
R = cumsum(x)
R = cumsum(x,dim)
Inputs
- x
 - Any valid scalar | vector | matrix.
 - dim
 - The dimension on which to accumulate.
 
Outputs
- R
 - The cumulative sum.
 
Examples
Using default dimension
cumsum([1,2,3;4,5,6])
      ans = [Matrix] 2 x 3
1  2  3
5  7  9
      Using row dimension
cumsum([1,2,3;4,5,6],2)
      ans = [Matrix] 2 x 3
1  3   6
4  9  15