How to creat a pairwise comparison matrix using a for loop ?
19 ビュー (過去 30 日間)
古いコメントを表示
Alejandrina Segura Delgado
2021 年 4 月 22 日
コメント済み: Alejandrina Segura Delgado
2021 年 4 月 23 日
i have this matrix:
A=[2 3
4 7
5 4
2 1];
I need to get the following comparasion matrix
B=[
2-4 3-7
2-5 3-4
2-2 3-1
4-5 7-4
4-2 7-1
5-2 4-1]
B=
-2 -4
-3 -1
0 2
-1 3
2 6
3 3
0 件のコメント
採用された回答
Jan
2021 年 4 月 22 日
A=[2 3; ...
4 7; ...
5 4; ...
2 1];
idx = nchoosek(1:size(A, 1), 2);
B = A(idx(:, 1), :) - A(idx(:, 2), :)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!