For example I have a matrix B with n=3,m=7
B =[ 0 0 0 0 0 0 -100; 0 0 0 0 0 0 -100; 0 0 0 0 0 0 -100;]
I want to reshape it to n*m,1 (21,1)
B = [0; 0; 0; 0; 0; 0; -100; 0; 0; 0; 0; 0; 0; -100; 0; 0; 0; 0; 0; 0; -100;];
I tried using reshape(B,21,1) or reshape(B,[],1) or reshape(B,[21,1]) but it converts it into
B = [0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; -100; -100; -100;];
Best Answer