フィルターのクリア

How to permute the columns in a matrix in random way?

4 ビュー (過去 30 日間)
kortas manel
kortas manel 2016 年 12 月 6 日
コメント済み: ghali ahmed 2017 年 12 月 25 日
Hi, How to permute the columns in a matrix in randomly without changing its size ??

採用された回答

KSSV
KSSV 2016 年 12 月 6 日
k = rand(100) ;
ny =size(k,2) ;
shuffle = randsample(1:ny,ny) ;
k_shuffle = k(:,shuffle) ;
  2 件のコメント
kortas manel
kortas manel 2016 年 12 月 6 日
Thank you this is what i am looking for
ghali ahmed
ghali ahmed 2017 年 12 月 25 日
thank you very much ! :)

サインインしてコメントする。

その他の回答 (1 件)

Daniel Morais
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.

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by