cummax
Cumulative maximum
Description
returns the
cumulative maximum elements of M
= cummax(A
)A
.
If
A
is a vector, thenM
is a vector of the same size and type and contains the cumulative maxima ofA
.If
A
is a matrix, thenM
is a matrix of the same size and type and contains the cumulative maxima in each column ofA
.If
A
is a multidimensional array, thenM
is an array of the same size and type and contains the cumulative maxima along the first array dimension ofA
whose size does not equal 1.If
A
is a table or timetable, thencummax(A)
returns a table or timetable containing the cumulative maxima of each variable. (since R2023a)
specifies the direction for any of the previous syntaxes. For example,
M
= cummax(___,direction
)cummax(A,2,"reverse")
returns the cumulative maxima of
A
by working from end to beginning of the second dimension of
A
.
Examples
Input Arguments
Tips
The
"reverse"
option in many cumulative functions allows quick directional calculations without requiring a flip or reflection of the input array.