for loop and matrix
2 views (last 30 days)
Show older comments
hi i have this matrix :
Loudness=[2.79;3.16;3.71;2.29;2.49;2.64;2.9;2.79;2.91;3.35];
FlucStr=[0.0256;0.0277;0.0311;0.0246;0.021;0.0199;0.0194;0.0256;0.0213;0.0208];
Roughness=[0.491;0.6;0.728;0.34;0.425;0.515;0.617;0.491;0.389;0.438];
Sharpness=[1.03;1.11;1.21;0.887;0.934;0.954;0.985;1.03;1.04;1.12];
Leq=[39.7;40.9;42.6;38.1;38.9;39.5;40.6;39.7;40.3;41.7];
SIL=[29.4;30.9;32.9;26.9;28;28.8;30.1;29.4;28.8;30];
Tonality=[0.133;0.128;0.113;0.153;0.14;0.131;0.118;0.133;0.203;0.18];
Kurtosis=[2.2;2.2;2.2;2.44;2.49;2.48;2.45;2.2;2.39;2.38];
subjective=[7.5;7.02;6.94;7.91;7.96;7.91;7.78;7.42;7.86;7.47];
metriche=[Loudness FlucStr Roughness Sharpness Leq SIL Tonality Kurtosis];
and i need to select with the command for loop 2 every combination of column vectors like:
Loudness FlucStr, Loudness FlucStr , Loudness Roughness, Loudness Sharpness, Loudness Leq, Loudness SIL , Loudness Tonality, Loudness Kurtosis,
FlucStr Roughness, FlucStr Sharpness, FlucStr Leq, FlucStr SIL, FlucStr Tonality, FlucStr Kurtosis, ......................ecc
Accepted Answer
Ted Shultz
on 11 Sep 2019
use nchoosek to get all the pairs:
Loudness=[2.79;3.16;3.71;2.29;2.49;2.64;2.9;2.79;2.91;3.35];
FlucStr=[0.0256;0.0277;0.0311;0.0246;0.021;0.0199;0.0194;0.0256;0.0213;0.0208];
Roughness=[0.491;0.6;0.728;0.34;0.425;0.515;0.617;0.491;0.389;0.438];
Sharpness=[1.03;1.11;1.21;0.887;0.934;0.954;0.985;1.03;1.04;1.12];
Leq=[39.7;40.9;42.6;38.1;38.9;39.5;40.6;39.7;40.3;41.7];
SIL=[29.4;30.9;32.9;26.9;28;28.8;30.1;29.4;28.8;30];
Tonality=[0.133;0.128;0.113;0.153;0.14;0.131;0.118;0.133;0.203;0.18];
Kurtosis=[2.2;2.2;2.2;2.44;2.49;2.48;2.45;2.2;2.39;2.38];
subjective=[7.5;7.02;6.94;7.91;7.96;7.91;7.78;7.42;7.86;7.47];
metriche=[Loudness FlucStr Roughness Sharpness Leq SIL Tonality Kurtosis];
pairList = nchoosek(1:8,2);
for ii = 1:size(pairList,1)
thisMatrix = metriche(:,pairList(11,:)) % dispaly to screen
end
2 Comments
Ted Shultz
on 11 Sep 2019
to get all combinations of 3 columns, use nchoosek(1:8,3)
to get all combinations of 4 columns, use nchoosek(1:8,4)
More Answers (0)
See Also
Categories
Find more on Measurements and Spatial Audio in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!