www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/ProductofElementsinEachRowExample.m
%% Product of Elements in Each Row %% % Create a 3-by-3 array whose elements correspond to their linear indices. A=[1:3:7;2:3:8;3:3:9] %% % Find the product of the elements in each row and reduce the length of % the second dimension to 1. The length of the first dimension matches |size(A,1)|, and the length % of the second dimension is 1. dim = 2; B = prod(A,dim)