Changing Dimensions:
In addition to transpose operator, the MATLAB has some built-in functions which change the dimensions or configuration of matrices, involving fliplr, reshape, flipud, and rot90.
The function reshape changes the dimensions of a matrix. The matrix variable below mat is 3 4, or in another words it has 12 elements.
>> mat = randint(3,4,[1 100])
mat =
14 61 2 94
21 28 75 47
20 20 45 42
These 12 values rather than it could be arranged as a 2 6 matrix, 6 2, 4 3, 1 12, & 12 1. The function reshape iterates throughout the matrix column wise. For illustration, whenever reshaping mat into a 2 6 matrix, the value from the first column in the original matrix (14, 21, and 20) are used first, then the values from the second column (61, 28, 20), and so on.
>> reshape(mat,2,6)
ans =
14 20 28 2 45 47
21 61 20 75 94 42