How to permute the columns in a matrix in random way?
4 ビュー (過去 30 日間)
古いコメントを表示
Hi, How to permute the columns in a matrix in randomly without changing its size ??
0 件のコメント
採用された回答
KSSV
2016 年 12 月 6 日
k = rand(100) ;
ny =size(k,2) ;
shuffle = randsample(1:ny,ny) ;
k_shuffle = k(:,shuffle) ;
2 件のコメント
その他の回答 (1 件)
Daniel Morais
2017 年 3 月 21 日
Utilize x = x( : , randperm(c)), onde x é a matriz e c o número de colunas de x. O mesmo vale para a permutação de linhas: x = x( randperm(l) , : ) onde l é o número de linhas.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!