All combinations of matrix elements?
古いコメントを表示
Hello,
I'd like to find all combinations of 2 elements in a matrix.
For example, a = [1:4; 5:8; 9:12]', the result should be [1*1 1*2 1*3 1*4 1*5 ... 1*12 2*2 2*3 ... 2*12 3*3 ... 12*11 12*12]';
Thanks for your help!
1 件のコメント
Stephen23
2016 年 9 月 26 日
採用された回答
その他の回答 (1 件)
Andrei Bobrov
2016 年 9 月 23 日
編集済み: Andrei Bobrov
2016 年 9 月 23 日
b = a(:)*a(:).';
out = b(tril(true(size(b))));
カテゴリ
ヘルプ センター および File Exchange で Operators and Elementary Operations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!