Info
この質問は閉じられています。 編集または回答するには再度開いてください。
How to find all combinations of 3 of matrices but get the results named
1 回表示 (過去 30 日間)
古いコメントを表示
I have 1X1 matrices A = 2, B= 4 , C5 =10 , D=2 etc , basically 40 of such matrices, (I dont mind combining them into one matrix) I want every possible combination of 3 but a way to know which matrices made up each matrix.
for e.g if i get the combination 2 4 10 , I want to know that it came from D, B and C
0 件のコメント
回答 (1 件)
Star Strider
2016 年 2 月 14 日
One possibility:
VblNames = {'A' 'B' 'C5' 'D'};
VblVals = {2, 4, 10, 2};
idx = nchoosek(1:size(VblNames,2), 3);
Out = {VblNames(idx); VblVals(idx)};
Out{:}
ans =
'A' 'B' 'C5'
'A' 'B' 'D'
'A' 'C5' 'D'
'B' 'C5' 'D'
ans =
[2] [ 4] [10]
[2] [ 4] [ 2]
[2] [10] [ 2]
[4] [10] [ 2]
0 件のコメント
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!