B = cumprod(A,dim) returns
the cumulative product along dimension dim. For
example, if A is a matrix, then cumprod(A,2) returns
the cumulative product of each row.

B = cumprod(___,direction) optionally
specifies the direction using any of the previous syntaxes. You must
specify A, and optionally can specify dim.
For instance, cumprod(A,2,'reverse') returns the
cumulative product within the rows of A by working
from end to beginning of the second dimension.

Dimension to operate along, specified as a positive integer
scalar. If no value is specified, the default is the first array dimension
whose size does not equal 1.

Consider a two-dimensional input array, A.

cumprod(A,1) works along the rows
of A and returns the cumulative product of each
column.

cumprod(A,2) works along the columns
of A and returns the cumulative product of each
row.

cumprod returns A if dim is
greater than ndims(A).

Many cumulative functions in MATLAB^{®} support the 'reverse' option.
This option allows quick directional calculations without needing
a flip or reflection of the input array.