Matlab Matrix Reshaping and Resizing
B = reshape(A,m,n) returns the m-by-n matrix B whose elements are taken column-wise from A. An error results if A does not have m*n elements.
B = reshape(A,m,n,p,...) or B= reshape(A,[m n p ...]) returns an n-dimensional array with the same elements as A but reshaped to have the size m-by-n-by-p-by-.... The product of the specified dimensions, m*n*p*..., must be the same as prod(size(A)).
B = rot90(A) rotates matrix A counterclockwise by 90 degrees.
B = rot90(A,k) rotates matrix A counterclockwise by k*90 degrees, where k is an integer
*B = reshape(A,m,n) returns the m-by-n matrix B whose elements are taken column-wise from A. An error results if A does not have m*n elements
>> S=[1 3 4 6 7;1 2 4 6 3; 3 2 5 7 9]
S =
1 3 4 6 7
1 2 4 6 3
3 2 5 7 9
*B = reshape(A,m,n,p,...) or B= reshape(A,[m n p ...]) returns an n-dimensional array with the same elements as A but reshaped to have the size m-by-n-by-p-by-.... The product of the specified dimensions, m*n*p*..., must be the same as prod(size(A)).
>> T = reshape(S,5,3)
T =
1 2 6
1 4 7
3 4 7
3 5 3
2 6 9
*B = rot90(A) rotates matrix A counterclockwise by 90 degrees.
*B = rot90(A,k) rotates matrix A counterclockwise by k*90 degrees, where k is an integer.
>> A=[5 6 8; 8 9 2; 8 0 9]
A =
5 6 8
8 9 2
8 0 9
>> B=rot90(A)
B =
8 2 9
6 9 0
5 8 8
*B = rot90(A,k) rotates matrix A counterclockwise by k*90 degrees, where k is an integer
>> B=rot90(A,4)
B =
5 6 8
8 9 2
8 0 9
* B = rot90(A,k) rotates matrix A counterclockwise by k*90 degrees, where k is an integer
>> B=rot90(A,2)
B =
9 0 8
2 9 8
8 6 5
*B = rot90(A,k) rotates matrix A counterclockwise by k*90 degrees, where k is an integer
>> B=rot90(A,3)
B =
8 8 5
0 9 6
9 2 8