prod
Product of array elements.
Syntax
Section titled “Syntax”B = prod(A)B = prod(A, dim)Description
Section titled “Description”Returns the product of A’s elements. With no dimension argument, multiplies along the first non-singleton dimension. With dim, multiplies along that dimension. NaN values cause the product to be NaN.
Examples
Section titled “Examples”prod([1 2 3 4]) % 24prod([1 2; 3 4]) % [3 8] column productsprod([1 2; 3 4], 2) % [2; 12] row products