I have a martix and want to shuffle element of it .
x=[1 2 5 4 6 ]
after shuffle(something like this)
x=[2 4 6 5 1]
is matlab has function for it ? in php array_shuffle do this.
obtain shuffled indices using randperm
randperm
idx = randperm(length(x));
use indices to obtain shuffled vector
xperm = x(idx);
1.4m articles
1.4m replys
5 comments
57.0k users