MATLAB: How to permute the columns in a matrix in random way

columnsmatrixpermutation

Hi, How to permute the columns in a matrix in randomly without changing its size ??

Best Answer

k = rand(100) ;
ny =size(k,2) ;
shuffle = randsample(1:ny,ny) ;
k_shuffle = k(:,shuffle) ;