To reshape a matrix in Matlab with the size of 768x10, use the reshape
function. In this example, let's say we have a matrix A
with dimensions of 64x120:
main.m19 chars2 lines
To reshape the matrix to 768x10:
main.m25 chars2 lines
The reshape
function takes two inputs: the original matrix A
, and a vector specifying the desired new dimensions of the matrix B
.
Note that the number of elements in the original matrix A
must be the same as the number of elements in the new matrix B
. Otherwise, you will receive an error stating that the reshape is not possible.
You can access elements of the reshaped matrix using indexing, just as you would with any other matrix in Matlab.
gistlibby LogSnag