MATLAB: I need to manipulate this matrix

matrix manipulation

A=[10 20 30 40;50 60 70 80;90 100 110 120]
%I need to order each rows vertically like that;
B=[10;20;30;40;50;60;70;80;90;100;110;120]

Best Answer

  • B = reshape(A',1,[]);
    Alternatively:
    B = A';
    B = B(:);