Cumulative sum

returns
the cumulative sum of `B`

= cumsum(`A`

)`A`

starting at the beginning
of the first array dimension in `A`

whose size does
not equal 1.

If

`A`

is a vector, then`cumsum(A)`

returns a vector containing the cumulative sum of the elements of`A`

.If

`A`

is a matrix, then`cumsum(A)`

returns a matrix containing the cumulative sums for each column of`A`

.If

`A`

is a multidimensional array, then`cumsum(A)`

acts along the first nonsingleton dimension.

Was this topic helpful?