p = prod(X)
prod(X), where X is a vector, is the product of the elements of X. For matrices, prod(X) is a row vector with the product over each column.
The product of the elements in each column isM = magic(3)M =8 1 63 5 74 9 2
The product of the elements in each row can be obtained by transposing twice.prod(M) =96 45 84
prod(M')' =4810572
cumprod,sum
(c) Copyright 1994 by The MathWorks, Inc.