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

 Réponse acceptée

Jiro Doke
Jiro Doke le 26 Fév 2012

30 votes

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

6 commentaires

N/A
N/A le 24 Oct 2017
briliant !
Farid Khosravikia
Farid Khosravikia le 17 Jan 2018
Awesome!
A Aftab
A Aftab le 18 Avr 2020
Super!
Mohan Kumar
Mohan Kumar le 26 Avr 2020
brilliant
Sivabalan Selvarajan
Sivabalan Selvarajan le 31 Mai 2020
Worked good !
Ahmad Momeni
Ahmad Momeni le 9 Nov 2020
Perfect!

Connectez-vous pour commenter.

Plus de réponses (2)

pavlos
pavlos le 28 Fév 2012

2 votes

Hello,
Yes, that worked fine.
Thank you.
Best,
Pavlos

1 commentaire

Jan
Jan le 28 Fév 2012
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.

Connectez-vous pour commenter.

Zeab
Zeab le 7 Nov 2018

1 vote

A simple line of code working great!

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by