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]
obtain shuffled indices using randperm
randperm
idx = randperm(length(x));
use indices to obtain shuffled vector
xperm = x(idx);