MATLAB Answers

0

Distributing the lines of any Matrix Randomly

Asked by Mahmoud Khadijeh on 10 Jun 2019
Latest activity Commented on by Mahmoud Khadijeh on 10 Jun 2019
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 ?

  0 Comments

Sign in to comment.

Tags

1 Answer

Answer by Shunichi Kusano on 10 Jun 2019
 Accepted Answer

A(randperm(3,3),:)
hope this helps.

  1 Comment

thank you very much,
yes that's exactly what I want

Sign in to comment.