%% Cumulative Maximum Values in Matrix Rows
% Find the cumulative maxima of the rows of a 3-by-3 matrix.

A = [3 5 2; 1 6 3; 7 8 1]

%

M = cummax(A,2)

% Copyright 2012 The MathWorks, Inc.