Organize matrix in a random way

조회 수: 2 (최근 30일)
eden meirovich
eden meirovich 2021년 4월 28일
댓글: eden meirovich 2021년 4월 28일
Hello, i have a matrix,H which have N rows and n columns.lets say N = 20 and n is 3. i would like to rearange only the rows in H, in a radom way. but keep every element in the say column he was before. so that h(1,:) will be moved to a radom place h(random number,:)
is there a built in function than can do this?
i think i know how to di it by my self, but can find anything bulit in.
thank u!

채택된 답변

Matt J
Matt J 2021년 4월 28일
N=size(H,1);
H=H(randperm(N),:);
  댓글 수: 3
Matt J
Matt J 2021년 4월 28일
You're welcome, but please Accept-click the answer to indicate that it resolved the question.
eden meirovich
eden meirovich 2021년 4월 28일
sure! thank u a lot Matt

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Particle & Nuclear Physics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by