MATLAB: How to randomizes the order of the rows of a matrix

permrandi

I have a matrix and I want to just change the order of the rows randomly. What is the best way to do this?

Best Answer

M = [1:100]'; %Your matrix
M = M(randperm(size(M,1)),:); %Your randomly permuted matrix by row