Generate same random permutations (reshape) for sequence?
Show older comments
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.
Answers (1)
madhan ravi
on 17 Dec 2018
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 Comments
Barbossa H
on 17 Dec 2018
Jan
on 17 Dec 2018
@Barbossa H: Do you mean:
index = randperm(size(X, 1));
random_X = X(index, :);
random_Y = Y(index, :)
Barbossa H
on 18 Dec 2018
madhan ravi
on 18 Dec 2018
Edited: madhan ravi
on 18 Dec 2018
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.
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!