Distributing the lines of any Matrix Randomly

조회 수: 1 (최근 30일)
Mahmoud Khadijeh
Mahmoud Khadijeh 2019년 6월 10일
댓글: Mahmoud Khadijeh 2019년 6월 10일
Hello , I have a question Please
if I have a matrix like this:
A=[ 1 2 3
4 5 6
7 8 9 ] ;
in each time I run the script , I want to redistribute the lines Randomly, for example like these :
A=[ 4 5 6
1 2 3
7 8 9];
-----------------------
A=[ 1 2 3
7 8 9
4 5 6];
Any simple way to do that ?

채택된 답변

Shunichi Kusano
Shunichi Kusano 2019년 6월 10일
A(randperm(3,3),:)
hope this helps.
  댓글 수: 1
Mahmoud Khadijeh
Mahmoud Khadijeh 2019년 6월 10일
thank you very much,
yes that's exactly what I want

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

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by