How to reshape a matrix

7 visualizaciones (últimos 30 días)
Theo Sotiris
Theo Sotiris el 13 de Sept. de 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?

Respuesta aceptada

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

Más respuestas (1)

Matt Fig
Matt Fig el 13 de Sept. de 2012
Editada: Matt Fig el 13 de Sept. de 2012
A = rand(2,2,2,2);
B = A(:);
size(B)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by