How to randomly moving rows of a matrix

1 回表示 (過去 30 日間)
mr mo
mr mo 2017 年 12 月 2 日
コメント済み: mr mo 2017 年 12 月 2 日
I have a hypothetical matrix named A, e.g.
A=[1 2 3
4 5 6
7 8 9
4 6 8
3 4 7
6 8 9
2 4 9
2 3 7
1 5 7
9 6 7];
I want to move the rows of A randomly to have a new matrix A with different arrange of rows.
How can I do that?
Thanks.

採用された回答

the cyclist
the cyclist 2017 年 12 月 2 日
randomOrder = randperm(size(A,1));
newA = A(randomOrder,:);
  1 件のコメント
mr mo
mr mo 2017 年 12 月 2 日
Thank you very much.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by