Show All Possible Combination and Max. Value
Mostrar comentarios más antiguos
I have 6 different matrix (A,B,C,D,E,F).
A = [
Row1 Row2 Row3 Row4
30 30A 9.2588 0.2059
60 60A 18.5053 0.4054
90 90A 27.7393 0.5983
120 120A 36.961 0.7847
150 150A 46.1702 0.9645
180 180A 55.3671 1.1379
]
B = [
Row1 Row2 Row3 Row4
30 30B 9.2588 0.2059
60 60B 18.5053 0.4054
90 90B 27.7393 0.5983
120 120B 36.961 0.7847
150 150B 46.1702 0.9645
180 180B 55.3671 1.1379
]
C = [
Row1 Row2 Row3 Row4
30 30C 6.4351 0.314
60 60C 12.8844 0.6176
90 90C 19.3479 0.911
120 120C 25.8256 1.1941
150 150C 32.3175 1.4669
180 180C 38.8235 1.7294
]
D = [
Row1 Row2 Row3 Row4
30 30D 9.8998 0.2259
60 60D 19.6938 0.4449
90 90D 29.3821 0.657
120 120D 38.9645 0.8622
150 150D 48.4412 1.0606
180 180D 57.8121 1.2521
]
E = [
Row1 Row2 Row3 Row4
30 30E 6.4351 0.314
60 60E 12.8844 0.6176
90 90E 19.3479 0.911
120 120E 25.8256 1.1941
150 150E 32.3175 1.4669
180 180E 38.8235 1.7294
]
F = [
Row1 Row2 Row3 Row4
30 30F 9.8998 0.2259
60 60F 19.6938 0.4449
90 90F 29.3821 0.657
120 120F 38.9645 0.8622
150 150F 48.4412 1.0606
180 180F 57.8121 1.2521
]
I am looking for combination of A+B, A+C, A+D, A+E, A+F, B+C, ...., A+B+C, A+B+D, ... A+B+C+D, A+B+C+E, ... A+B+C+D+E+F.
For example, the result of A+B
A+B = [
Row1 Row2 Row3 Row4
30+30 30A+30B 9.2588+9.2588 0.2059+0.2059
30+60 30A+60B 9.2588+18.5053 0.2059+0.4054
...
60+30 60A+30B 18.5053+9.2588 0.4054+0.4054
180+180 180A+180B 55.3671+55.3671 1.1379+1.1379
]
= [
Row1 Row2 Row3 Row4
60 30A+30B 18.5176 0.4118
90 30A+60B 27.7641 0.6113
...
90 60A+30B 27.7641 0.6113
360 180A+180B 110.7342 2.27958
]
Finally, I hope to find the max value of row 4 when the value in row 1 is equal in all combination, such as
Row 1 column1 (30) in A compare with Row 1 column 1 (30) in C,
Max value [
Row1 Row2 Row3 Row4
30 30C 6.4351 0.314
]
Thank you for your help!
2 comentarios
Jos (10584)
el 30 de Nov. de 2017
What does 30A represent? A value?
beeno beeno
el 30 de Nov. de 2017
Editada: beeno beeno
el 30 de Nov. de 2017
Respuesta aceptada
Más respuestas (1)
Andrei Bobrov
el 30 de Nov. de 2017
Editada: Andrei Bobrov
el 30 de Nov. de 2017
M = {A;B;C;D;E;F};
CL = cat(3,M{:});
[m,n,k] = size(CL);
out = cell(k-1,1);
for ii = 2:k
a = nchoosek(1:k,ii);
out{ii-1} = squeeze(sum(reshape(CL(:,:,a),[m,n,size(a,1),ii]),4));
end
out = cat(3,out{:});
Categorías
Más información sobre Parametric Modeling en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!