| MATLAB Function Reference | ![]() |
B = prod(A)
B = prod(A,dim)
B = prod(A) returns the products along different dimensions of an array.
If A is a vector, prod(A) returns the product of the elements.
If A is a matrix, prod(A) treats the columns of A as vectors, returning a row vector of the products of each column.
If A is a multidimensional array, prod(A) treats the values along the first non-singleton dimension as vectors, returning an array of row vectors.
B = prod(A,dim) takes the products along the dimension of A specified by scalar dim.
The magic square of order 3 is
M = magic(3)
M =
8 1 6
3 5 7
4 9 2 The product of the elements in each column is
prod(M) =
96 45 84 The product of the elements in each row can be obtained by:
prod(M,2) =
48
105
72![]() | printpreview | profile | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |