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
1 2 3
4 5 6
It is indeed reshape(A',cols,rows)'
( reshape(a', 3, 2)' in your example)
How about this?
reshape(a, 3, 2)'
The general way to reshape an m*n
matrix A to a p*k
matrix B in a row-wise manner is:
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]