MATLAB: How Can I mix the matrix randomly

matrix

Bascially I have a matrix of size 100*100 and I want to reorder it randomly , how can I do that ?
Also can I do that by using randi ?
thanks

Best Answer

One way: Here data is 100 by 100 matrix
mat_data=data(:);
result=reshape(mat_data(randperm(100*100)),[100,100]);