Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
How to find all combinations of 3 of matrices but get the results named
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Star Strider
el 14 de Feb. de 2016
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 comentarios
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!