for loop and matrix

조회 수: 1 (최근 30일)
mohamed gryaa
mohamed gryaa 2019년 9월 11일
댓글: Ted Shultz 2019년 9월 11일
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
  댓글 수: 1
Stephen23
Stephen23 2019년 9월 11일
@mohamed gryaa: you should probably store your data in a table:

댓글을 달려면 로그인하십시오.

채택된 답변

Ted Shultz
Ted Shultz 2019년 9월 11일
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
mohamed gryaa
mohamed gryaa 2019년 9월 11일
can i do this with 3 or 4 or all vector column?
Ted Shultz
Ted Shultz 2019년 9월 11일
to get all combinations of 3 columns, use nchoosek(1:8,3)
to get all combinations of 4 columns, use nchoosek(1:8,4)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by