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);
2.1m questions
2.1m answers
60 comments
57.0k users