You can reshape a matrix of size [25x2] to [1x1x15] in Matlab by following the code below:
main.m110 chars6 lines
Explanation:
reshape
takes the original matrix A
as its first input.'
operator is used to transpose A
so that we get a row vector of length 50.reshape
.1x1x15
to get a 3D array of dimensions 1 x 1 x 15, which is equivalent to a matrix of size [1x15] where each element is a row vector of length 2.Note that the '
operator is used to ensure that the original matrix A
is reshaped column-wise.
gistlibby LogSnag