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
2018-12-17
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
2018-12-17
Jan
2018-12-17
@Barbossa H: Do you mean:
index = randperm(size(X, 1));
random_X = X(index, :);
random_Y = Y(index, :)
Barbossa H
2018-12-18
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 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!