フィルターのクリア

How to transpose values of arrays between matrices

2 ビュー (過去 30 日間)
bsriv
bsriv 2018 年 10 月 25 日
コメント済み: bsriv 2018 年 10 月 25 日
Hi I'm stuck and would be very grateful for any help[- So I have two correlation matrices, all values between -1 and 1: x: 59412x84 y: 59412x315
I have another array z which is 91282x1, which is all zeros except for indices 59472:59555 which are either 1, 2, or 3. LCorr So, I corr(x,y) to get an 84x315 correlation matrix (I'll call it corrxy).
Then I want a winner take all of the columns so I do [~,Indices]=max(abs(corrxy), which produces a 1x315 array with values at each index between 1 and 84. So far so good.
Those values (1 to 84) correspond to the values in "z" (1,2,3) as described above; however it's not the exact indices 1:84 it's the 84 indices 59472:59555. So the issue that's vexing me is how to replace the 315 "1 to 84" values in "Indices" with their corresponding 1,2,or,3 from Z in order to get a 1x315 array with values 1,2,or 3.
Thanks!!!

採用された回答

Andrei Bobrov
Andrei Bobrov 2018 年 10 月 25 日
編集済み: Andrei Bobrov 2018 年 10 月 25 日
z = z(:)';
zz = z(59472:59555);
out = zz(Indices);
  1 件のコメント
bsriv
bsriv 2018 年 10 月 25 日
Awesome thank you so much!!!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSoftware Development Tools についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by