Generate same random permutations (reshape) for sequence?

I amlooking for a way genrate random permutation function for X and Y.
Example:
X = randi ([0 1], 10,1);
Y = bsc(A, 0.05);
If I reshape the data
reshape([X;Y],1,[]);
0 0 0 1 0 0 0 0 1 0 1 0 0 0 1 0 1 0 1 0
but here I want X Y reshape row wise
like
0 0
0 1 ....etc
Someone could help me.

回答 (1 件)

madhan ravi
madhan ravi 2018 年 12 月 17 日

1 投票

a=[0 0 0 1 0 0 0 0 1 0 1 0 0 0 1 0 1 0 1 0];
reshape(a,2,[])'

4 件のコメント

Barbossa H
Barbossa H 2018 年 12 月 17 日
Whenever I apply random permutation like,
random_X = X(randperm(size(X, 1)), :), random_Y = Y(randperm(size(Y, 1)), :)
it gives me different bit position of X and Y. but I want to apply random permutation condition for both X and Y.
Example: X (bit Position) Y (bit position)
5 5
9 9
1 1
thanks
Jan
Jan 2018 年 12 月 17 日
@Barbossa H: Do you mean:
index = randperm(size(X, 1));
random_X = X(index, :);
random_Y = Y(index, :)
Barbossa H
Barbossa H 2018 年 12 月 18 日
Yes, Thank you. I got it
madhan ravi
madhan ravi 2018 年 12 月 18 日
編集済み: madhan ravi 2018 年 12 月 18 日
Thank you Jan , @Barbossa if you got the answer to your question make sure to accept the answer so that people know the question is solved.

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

カテゴリ

ヘルプ センター および File Exchange で Particle & Nuclear Physics についてさらに検索

製品

リリース

R2018b

質問済み:

2018 年 12 月 17 日

編集済み:

2018 年 12 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by