FUNCTION REFERENCE

prod

Product along an array dimension.

Product along an array dimension.

Syntax

prod(A)

Syntax

prod(A, dim)

Multiplies along the first nonsingleton dimension by default: across a row vector, or down matrix columns. Dim 1 works down rows; dim 2 works across columns; dim above 2 leaves the values unchanged. Empty products are 1. Real, complex and logical inputs are accepted; logical inputs convert to double.

Example

prod([1 2;3 4],2)   % [2; 12]

Differences from MATLAB: Output-class and NaN-handling options are not supported for 2-D input. A complex product with zero imaginary parts is real. N-D arrays (part 2): dim, vecdim, 'all', 'omitnan'/'includenan' and 'double'/'native'/'default'; an integer product is double unless 'native', which saturates.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.