swap matrix row randomly

64 ビュー (過去 30 日間)
pavlos
pavlos 2012 年 2 月 26 日
コメント済み: Ahmad Momeni 2020 年 11 月 9 日
Hello,
I have a 10x20 matrix and I`d like to change the rows randomly. For example, the 1st row will become, let`s say, the 9th, the 2nd will become the 5th, etc.
Any help?
Thank you.
Best,
Pavlos

採用された回答

Jiro Doke
Jiro Doke 2012 年 2 月 26 日
random_x = x(randperm(size(x, 1)), :)
  6 件のコメント
Sivabalan Selvarajan
Sivabalan Selvarajan 2020 年 5 月 31 日
Worked good !
Ahmad Momeni
Ahmad Momeni 2020 年 11 月 9 日
Perfect!

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

その他の回答 (2 件)

pavlos
pavlos 2012 年 2 月 28 日
Hello,
Yes, that worked fine.
Thank you.
Best,
Pavlos
  1 件のコメント
Jan
Jan 2012 年 2 月 28 日
Please post a comment to an answer in the comment section for the answer. If an answer solves youzr problem, you can "accept" it to show, that no further assistence is required.

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


Zeab
Zeab 2018 年 11 月 7 日
A simple line of code working great!

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by