Randomly makes matrix rows as one vector

4 vues (au cours des 30 derniers jours)
Abe
Abe le 19 Jan 2015
Commenté : Abe le 22 Jan 2015
Hello all, I would like to work on a marix that should be converted to on vector (by rows), but my question here is how I can convert these rows in my matrix to one vector but randomly sorting, I mean that it should be not [row1, row2,.....] but like for example [row2, row8, ... so on].

Réponse acceptée

per isakson
per isakson le 19 Jan 2015
Hint
M = magic( 7 );
R = M( randperm(7), : );
  2 commentaires
Roger Stafford
Roger Stafford le 19 Jan 2015
Modifié(e) : Image Analyst le 19 Jan 2015
Add on the line
M_new = reshape(R',1,[]);
to make it "on(e) vector".
Abe
Abe le 22 Jan 2015
Thank you guys for these ideas.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by