You can convert a 5 by 10 array into a 2 by 25 cell array in MATLAB using the reshape
function and then transposing the result. Here is an example code:
main.m157 chars4 lines
In the above code, A
is a 5 by 10 array of numbers. The mat2cell
function is used to convert A
into a 2 by 25 cell array B
with the desired grouping of rows and columns. The resulting B
is then transposed using the '
operator to get the final 2 by 25 cell array C
. Note that the mat2cell
function splits A
into rows of size 2 and 3 for the first and second row of B
, respectively, and columns of size 5 for each of the 2 rows.
gistlibby LogSnag