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

 채택된 답변

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

댓글 수: 3

Many thanks Andrei! You've made my day

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!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

2015년 3월 27일

댓글:

2015년 3월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by