How to reshape a matrix

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?

 Akzeptierte Antwort

James Tursa
James Tursa am 13 Sep. 2012

0 Stimmen

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

Weitere Antworten (1)

Matt Fig
Matt Fig am 13 Sep. 2012
Bearbeitet: Matt Fig am 13 Sep. 2012

0 Stimmen

A = rand(2,2,2,2);
B = A(:);
size(B)

Kategorien

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by