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 日

30 投票

random_x = x(randperm(size(x, 1)), :)

6 件のコメント

N/A
N/A 2017 年 10 月 24 日
briliant !
Farid Khosravikia
Farid Khosravikia 2018 年 1 月 17 日
Awesome!
A Aftab
A Aftab 2020 年 4 月 18 日
Super!
Mohan Kumar
Mohan Kumar 2020 年 4 月 26 日
brilliant
Sivabalan Selvarajan
Sivabalan Selvarajan 2020 年 5 月 31 日
Worked good !
Ahmad Momeni
Ahmad Momeni 2020 年 11 月 9 日
Perfect!

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

その他の回答 (2 件)

pavlos
pavlos 2012 年 2 月 28 日

2 投票

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 日

1 投票

A simple line of code working great!

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

質問済み:

2012 年 2 月 26 日

コメント済み:

2020 年 11 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by