%% Reverse Cumulative Product
% Create a 3-by-3 matrix of random integers between 1 and 10.

rng default;
A = randi([1,10],3)

%
% Calculate the cumulative product along the columns. Specify the 'reverse' option to work from bottom to top in each column. The result is the same size as A.

B = cumprod(A,'reverse')

% Copyright 2012 The MathWorks, Inc.