MATLAB: How to make a 3×3 matrix a 9×1 matrix

matrixmatrix manipulation

Hey i have a matrix x=[ 1 4 7; 2 5 8 ;3 6 9]; how do I make this matrix become x=[ 1;2;3;4;5;6;7;8;9];

Best Answer

reshape(x,9,1)
or
x(:) % this creates a column vector out of a matrix