How to reshape a matrix

조회 수: 8 (최근 30일)
Theo Sotiris
Theo Sotiris 2012년 9월 13일
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?

채택된 답변

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

추가 답변 (1개)

Matt Fig
Matt Fig 2012년 9월 13일
편집: Matt Fig 2012년 9월 13일
A = rand(2,2,2,2);
B = A(:);
size(B)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by