# prod

Product of array elements

## Syntax

## Description

returns the product of the array elements of `B`

= prod(`A`

)`A`

.

If

`A`

is a vector, then`prod(A)`

returns the product of the elements.If

`A`

is a nonempty matrix, then`prod(A)`

treats the columns of`A`

as vectors and returns a row vector of the products of each column.If

`A`

is an empty 0-by-0 matrix,`prod(A)`

returns`1`

.If

`A`

is a multidimensional array, then`prod(A)`

acts along the first nonsingleton dimension and returns an array of products. The size of`B`

in this dimension reduces to`1`

, while the sizes of all other dimensions remain the same as in`A`

.If

`A`

is a table or timetable, then`prod(A)`

returns a one-row table of the products of each variable.*(since R2023a)*

`prod`

computes and returns `B`

as
`single`

when the input, `A`

, is
`single`

. For all other numeric and logical data types,
`prod`

computes and returns `B`

as
`double`

.

## Examples

## Input Arguments

## Output Arguments

## More About

## Extended Capabilities

## Version History

**Introduced before R2006a**