Distributing the lines of any Matrix Randomly

1 Ansicht (letzte 30 Tage)
Mahmoud Khadijeh
Mahmoud Khadijeh am 10 Jun. 2019
Kommentiert: Mahmoud Khadijeh am 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 ?

Akzeptierte Antwort

Shunichi Kusano
Shunichi Kusano am 10 Jun. 2019
A(randperm(3,3),:)
hope this helps.

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by