Arranging a vector to new index position

2 ビュー (過去 30 日間)
rakesh kumar
rakesh kumar 2023 年 1 月 25 日
移動済み: Jan 2023 年 1 月 25 日
I have a vector E= [E1, E2.... En]. I have shuffled it's index with randomperm. I want to arrange the vector E according to new index.

採用された回答

Dyuman Joshi
Dyuman Joshi 2023 年 1 月 25 日
移動済み: Jan 2023 年 1 月 25 日
You mean like this
n=15;
E = randi(50,1,n)
E = 1×15
24 37 16 40 45 46 49 29 48 38 32 49 43 6 22
idx = randperm(n)
idx = 1×15
6 12 5 3 4 8 2 15 10 13 7 11 9 14 1
Eprime = E(idx)
Eprime = 1×15
46 49 45 16 40 29 37 22 38 43 49 32 48 6 24
  1 件のコメント
rakesh kumar
rakesh kumar 2023 年 1 月 25 日
移動済み: Jan 2023 年 1 月 25 日
Thank you Dyuman

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by