how to get combination of elements in a matrix in pair order
1 回表示 (過去 30 日間)
古いコメントを表示
I have a matrix A=[3 5 6 7 8]
i want the output in the form B= [ 3 5
3 6
3 7
3 8
5 3
5 6
5 7
5 8...] like this
0 件のコメント
採用された回答
その他の回答 (1 件)
Andrei Bobrov
2019 年 7 月 11 日
編集済み: Andrei Bobrov
2019 年 7 月 11 日
A=[3 5 6 7 8];
[y,x] = ndgrid(A);
B = [x(:),y(:)];
B = B(diff(B,1,2) ~= 0,:);
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!