A =
1 4 7 10
2 5 8 11
3 6 9 12
B = reshape(A,2,6)
B =
1 3 5 7 9 11
2 4 6 8 10 12
B = reshape(A,2,[])
B =
1 3 5 7 9 11
2 4 6 8 10 12
RESHAPE(X,M,N) returns the M-by-N matrix whose elements
are taken columnwise from X. An error results if X does
not have M*N elements.
rowwise just RESHAPE(X',M,N)'