Say I have a matrix a = [1 2 3 4 5 6];, how do I reshape it in a row-wise manner for example reshape(a, 2, 3) to yield
a = [1 2 3 4 5 6];
reshape(a, 2, 3)
1 2 3 4 5 6 >
The general way to reshape an m*n matrix A to a p*k matrix B in a row-wise manner is:
m*n
p*k
c=reshape(A',1,m*n) B=reshape(c,k,p)' example: m=3 n=4 , p=6, q=2 A=[1 2 3 4; 5 6 7 8; 9 10 11 12] c=[1 2 3 4 5 6 7 8 9 10 11 12] B=[1 2 ; 3 4; 5 6; 7 8; 9 10; 11 12]