www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/CumulativeProductofEachRowinMatrixExample.m

    %% Cumulative Product of Each Row in Matrix  

%% 
% Define a 2-by-3 matrix whose elements correspond to their linear indices. 
A = [1 3 5; 2 4 6]  

%% 
% Find the cumulative product of the rows of |A|. The element |B(3)| is the product of |A(1)| and |A(3)|, while |B(5)| is the product
% of |A(1)|, |A(3)|, and |A(5)|.   
B = cumprod(A,2)