cumsum
Cumulative sum
Syntax
y = cumsum ( x )
y = x.cumsum ( )
Inputs
| Argument | Type | Description | Unit |
|---|---|---|---|
x | scalar | the array | n/a |
Outputs / Return Value
y:yis the cumulative sum ofx.
Notes
- If
xis a matrix,yis a matrix of row-wise operations
Examples
[1 2 3 4 5].cumsum → [1 3 6 10 15]
(1:12).matrix(3).cumsum →
ans =
1 3 6 10
5 11 18 26
9 19 30 42
See Also
- diff
reshape
Review Status
- Legacy parameter naming does not exactly match current engine metadata and should be reviewed manually.