Conversion of an matrix array

3 vues (au cours des 30 derniers jours)
Ajay Kumar
Ajay Kumar le 25 Jan 2019
Commenté : madhan ravi le 28 Jan 2019
How to convert a 50x50 matrix into 1x2500 matrix in matlab?

Réponse acceptée

madhan ravi
madhan ravi le 25 Jan 2019
reshape(matrix,1,[])
  2 commentaires
Walter Roberson
Walter Roberson le 25 Jan 2019
Note that this will proceed column by column, giving
 
[M(1,1), M(2,1), M(3,1), ... M(50,1), M(1,2), M(2,2), ... ]
This is one of the very fastest operations in MATLAB, as the data is not change: there is just a change to the header saying how to interpret the data.
If you want to proceed row by row,
[M(1,1), M(1,2), M(1,3), ... M(1,50), M(2,1), M(2,2) ....]
then you need
reshape(YourMatrix.', 1, []);
madhan ravi
madhan ravi le 28 Jan 2019
True sir Walter , thank you!

Connectez-vous pour commenter.

Plus de réponses (1)

madhan ravi
madhan ravi le 25 Jan 2019
Second way:
matrix(:).'

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by