FUNCTION REFERENCE
cumsum
Cumulative sum.
Cumulative sum.
Syntax
cumsum(A)Syntax
cumsum(A, dim)Works along the first non-singleton dimension unless dim is given.
Example
cumsum([1 2 3]) % [1 3 6]Example
cumsum(ones(1,2,3),3)Differences from MATLAB: Real and complex 2-D arrays; for 2-D input dim 3 or higher returns A unchanged. A complex 2-D result stays complex even when its imaginary parts are zero. N-D arrays (part 2): any dim, 'reverse'/'forward' and 'omitnan'/'includenan'; integer input keeps its class (exact running sum, saturated per element); a complex N-D result with zero imaginary parts is real.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.