How to find the product of each element of a matrix by itself and by the other elemets at the same row?

 Accepted Answer

EDIT
[n1,n2] = ndgrid(1:size(x));
y = x(:,nonzeros(tril(n1))).*x(:,nonzeros(tril(n2)));

3 Comments

Hi Andrei! Sorry it seems that I should have mentioned the dimension of my actual matrix, which is 85 * 15. I'm given this error: "Error using .* Matrix dimensions must agree." I appreciate your help again!

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!