Cumulative maximum
M = cummax(A) returns the cumulative maximum of the arguments of A. The dimension of M is same as the dimension of A. If A is a 2D matrix, the operation is performed along the columns. For a hypermatrix, the operation is performed along the first non-zero dimension M = cummax(A,dim) The operation is performed along the dimension specified by dim M = cummax(_,direction) direction specifies as the direction of operation