Hi. I need to reshape a T1 = [1×5] cell array, where each cell is a [5×1] cell array of numbers into a S1 = [m-by-n] matrix of numbers. The problem is the initial cell array T1 may have different number of rows in each cell – meaning I don't have a square shaped array to use " cell2mat " function.
Example:
T1=[1x5] cell arrayT1{1} T1{2} T1{3} T1{4} T1{5} 1 2 3 4 5 6 7 8 9 1011 12 13 14 1516 17 18 19 2021 22 23 24
I need to add all of the columns together:
T2= 1 2 3 4 5 6 7 8 9 1011 12 13 14 1516 17 18 19 2021 22 23 24
And then reshape the array into [m-by-n] array (always square shaped), in this example S1=[3×8]:
S1= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1617 18 19 20 21 22 23 24
I thought that maybe I could reshape T1 into [x-by-1] array and then reshape that array in to S1=[m-by-n]. But what should i do in order to get results like this:
T3=1234...24
And not like
161116212...24
Any help would be appreciated.
Best Answer