MATLAB: How to randomize the column position of a matrix

MATLABmatrix manipulation

suppose A=[D G H K … O];
i want to do C=[H D O …. G.. K]
i also want to keep the information about the order of randomization to use it other matrix further manipulation.

Best Answer

ind=randperm(size(A,2));
C=zeros(size(A));
C=A(:,ind);
ind preserves the order of randomization.