How to convert a column back into matrix?

A matrix can be converted in column using matrix(:) but how to convert it back into matrix of same order?

 Akzeptierte Antwort

Guillaume
Guillaume am 23 Mär. 2016

0 Stimmen

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.
If you do, use reshape:
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)

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 23 Mär. 2016

Bearbeitet:

am 23 Mär. 2016

Community Treasure Hunt

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

Start Hunting!

Translated by