MATLAB: Randomising a given matrics

random number generator

hello there i need to randomize a matrix and after that i need to get it back original matrix … can any one help me

Best Answer

I'll try to answer :)
% test matrix
a = reshape(1:100,10,10)
% randomize - mixing
idx = reshape(randperm(numel(a)),10,10);
b = a(idx)
[~ c] = sort(idx(:));
% restore matrix a
b = b(reshape(c,10,10))