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.

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).