www.gusucode.com > datafun 工具箱matlab源码程序 > datafun/cumprod.m
%CUMPROD Cumulative product of elements. % Y = CUMPROD(X) computes the cumulative product along the first non-singleton % dimension of X. Y is the same size as X. % % Y = CUMPROD(X,DIM) cumulates along the dimension specified by DIM. % % Y = CUMPROD(___,DIRECTION) cumulates in the direction specified by % DIRECTION using any of the above syntaxes: % 'forward' - (default) uses the forward direction, from beginning to end. % 'reverse' - uses the reverse direction, from end to beginning. % % Example: % X = [0 1 2; 3 4 5] % cumprod(X,1) % cumprod(X,2) % cumprod(X,1,'reverse') % cumprod(X,2,'reverse') % % See also PROD, CUMSUM, CUMMIN, CUMMAX. % Copyright 1984-2016 The MathWorks, Inc. % Built-in function.