How to get origin vector form indexd matrix
古いコメントを表示
I have a 1xK row vector A generated by randi function, and K is even number
K=6;
A = randi([50 500],1,K);
A will rearrage by a K/2x1 index matrix which the index matrix is obtained from some algorithm, for example
idx = [1 3;4 5;2 6];
B = A(idx);
I want to get a vector C same as A from B, but I can't do
C = A
in my case. How should I do?
Very appreciate for any suggestion.
採用された回答
その他の回答 (1 件)
Scott MacKenzie
2021 年 5 月 18 日
idx2 = [1 3 4 2 5 6];
C = B(idx2)
2 件のコメント
WJ
2021 年 5 月 18 日
Scott MacKenzie
2021 年 5 月 18 日
編集済み: Scott MacKenzie
2021 年 5 月 18 日
Ok, got it. See Jan's answer. He's nailed it.
カテゴリ
ヘルプ センター および File Exchange で Axes Transformations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!