필터 지우기
필터 지우기

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 CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by