How to permute the columns in a matrix in random way?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
kortas manel
am 6 Dez. 2016
Kommentiert: ghali ahmed
am 25 Dez. 2017
Hi, How to permute the columns in a matrix in randomly without changing its size ??
0 Kommentare
Akzeptierte Antwort
KSSV
am 6 Dez. 2016
k = rand(100) ;
ny =size(k,2) ;
shuffle = randsample(1:ny,ny) ;
k_shuffle = k(:,shuffle) ;
2 Kommentare
Weitere Antworten (1)
Daniel Morais
am 21 Mär. 2017
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 Kommentare
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!