Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Cumulative maximum

`M = cummax(A)`

`M = cummax(A,dim)`

`M = cummax(___,direction)`

`M = cummax(___,nanflag)`

returns
the cumulative maximum elements of `M`

= cummax(`A`

)`A`

. By default, `cummax(A)`

operates
along the first array dimension whose size does not equal 1.

If

`A`

is a vector, then`cummax(A)`

returns a vector of the same size containing the cumulative maxima of`A`

.If

`A`

is a matrix, then`cummax(A)`

returns a matrix of the same size containing the cumulative maxima in each column of`A`

.If

`A`

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

returns an array of the same size containing the cumulative maxima along the first array dimension of`A`

whose size does not equal 1.

The

`'reverse'`

option in many cumulative functions allows quick directional calculations without requiring a flip or reflection of the input array.