How to convert a column back into matrix?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
A matrix can be converted in column using matrix(:) but how to convert it back into matrix of same order?
0 commentaires
Réponse acceptée
Guillaume
le 23 Mar 2016
If you don't know what the original size of the matrix was, then you of course can't since matlab does not keep the information.
A = randi([1 20], 10, 20, 30);
B = A(:);
AA = reshape(B, 10, 20, 30);
isequal(A, AA) %will return true
Note that A(:) is equivalent to
reshape(A, [], 1)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrices and Arrays 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!