How can i randomly move the values of a vector

Hi everyone.
Suppose i have a column vector X=[1;2;5;7;8].Now i want randomly arrangement of the values of this vector.For example X1=[2,7,8,1,5] is one of such random arrangement.My purpose is to randomly movement of this vector values and then add it to another vector say Y in one of my simulation experiment.
THANKS WITH BEST WISHES

 採用された回答

Manolis Michailidis
Manolis Michailidis 2015 年 7 月 23 日

1 投票

1 件のコメント

Manolis Michailidis
Manolis Michailidis 2015 年 7 月 23 日
sorry now i took a better look here try this
X=[1;2;5;7;8];
n=length(X);
y = datasample(X,n,'Replace',false)

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

その他の回答 (1 件)

Thorsten
Thorsten 2015 年 7 月 23 日

0 投票

X = X(randperm(numel(X));

カテゴリ

ヘルプ センター および File ExchangePhysics についてさらに検索

タグ

質問済み:

2015 年 7 月 23 日

回答済み:

2015 年 7 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by