How to reshape a matrix

11 visualizzazioni (ultimi 30 giorni)
Theo Sotiris
Theo Sotiris il 13 Set 2012
Hello , i've got a k by l by m by n by o matrix and i want to reshape it into a vector.. Any ideas?

Risposta accettata

James Tursa
James Tursa il 13 Set 2012
A = zeros(k,l,m,n,o);
B = A(:); % column vector
C = B.'; % row vector
For more general reshaping, see the reshape command.

Più risposte (1)

Matt Fig
Matt Fig il 13 Set 2012
Modificato: Matt Fig il 13 Set 2012
A = rand(2,2,2,2);
B = A(:);
size(B)

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by