MATLAB: How to reshape a matrix

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?

Best Answer

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