B = reshape(A,m,n
)
B
=
reshape(A,m,n)
returns the m
-by-n
matrix B
whose elements are taken columnwise from A
. An error results if A
does not have m*n
elements.
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
reshape
is less cryptic. reshape
uses the equivalent colon notation:
B = zeros(m,n);
B(:) = A;
:
,fliplr
,flipud
,rot90
(c) Copyright 1994 by The MathWorks, Inc.