# cumprod

Cumulative product

## Description

returns the
cumulative product of `B`

= cumprod(`A`

)`A`

starting at the beginning of the first
array dimension in `A`

whose size is greater than 1.

If

`A`

is a vector, then`B`

is a vector of the same size containing the cumulative product of`A`

.If

`A`

is a matrix, then`B`

is a matrix of the same size containing the cumulative product in each column of`A`

.If

`A`

is a multidimensional array, then`B`

is an array of the same size containing the cumulative product along the first array dimension of`A`

whose size is greater than 1.If

`A`

is a table or timetable, then`M`

is a table or timetable of the same size containing the cumulative product in each variable of`A`

.*(since R2023a)*

The class of `B`

is the same as the class of `A`

except if `A`

is `logical`

, in which case
`B`

is `double`

.

specifies the direction for any of the previous syntaxes. For example,
`B`

= cumprod(___,`direction`

)`cumprod(A,2,"reverse")`

returns the cumulative product within
the rows of `A`

by working from end to beginning of the second
dimension.

## Examples

## Input Arguments

## Tips

The

`"reverse"`

option in many cumulative functions allows quick directional calculations without requiring a flip or reflection of the input array.

## Extended Capabilities

## Version History

**Introduced before R2006a**