MATLAB: Combine a cell array of cell arrays to a cell array of numbers

cellcell arraycell arrayscellfun

Hi,
I have a dynamic cell array of cell arrays and I want to combine it into a cell array of data.
For example:
kdata =
Columns 1 through 4
{10x3 cell} {10x3 cell} {10x3 cell} {10x3 cell}
Columns 5 through 8
{10x3 cell} {10x3 cell} {10x3 cell} {10x3 cell}
Columns 9 through 10
{10x3 cell} {10x3 cell}
What I want:
kdata_combined =
Columns 1 through 11
'8' '7' '2' '8' '10' '5' '1' '2' '1' '4' '3'
'2' '1' '4' '2' '3' '0' '3' '3' '0' '0' '0'
'1' '1' '1' '4' '4' '4' '1' '1' '2' '4' '2'
'3' '2' '1' '1' '2' '1' '1' '1' '0' '2' '2'
'2' '5' '0' '0' '1' '2' '0' '2' '0' '1' '0'
'0' '1' '3' '1' '1' '2' '1' '0' '0' '2' '1'
'0' '4' '0' '0' '1' '0' '1' '2' '1' '1' '0'
'2' '0' '0' '0' '0' '0' '0' '0' '1' '0' '0'
'2' '0' '0' '1' '0' '1' '2' '0' '0' '3' '0'
'0' '0' '1' '0' '1' '0' '1' '0' '2' '2' '1'
Columns 12 through 22
'11' '0' '2' '11' '6' '7' '6' '0' '5' '0' '4'
'2' '7' '2' '1' '1' '4' '6' '2' '0' '5' '3'
'2' '1' '1' '1' '1' '4' '3' '1' '2' '3' '0'
'2' '1' '2' '1' '1' '4' '0' '1' '0' '1' '2'
'2' '0' '1' '1' '1' '0' '2' '1' '1' '1' '3'
'0' '0' '0' '3' '0' '4' '0' '0' '0' '0' '1'
'3' '2' '1' '2' '2' '0' '2' '0' '0' '0' '1'
'2' '0' '3' '0' '1' '2' '0' '2' '1' '1' '0'
'1' '0' '1' '1' '0' '0' '2' '0' '2' '0' '0'
'0' '0' '0' '2' '2' '0' '1' '3' '0' '0' '0'
Columns 23 through 30
'1' '1' '3' '1' '2' '4' '5' '8'
'0' '0' '5' '4' '0' '2' '2' '7'
'1' '1' '3' '9' '0' '0' '4' '0'
'3' '1' '1' '0' '3' '0' '0' '1'
'3' '1' '0' '0' '0' '1' '1' '0'
'3' '1' '0' '1' '0' '1' '0' '2'
'1' '0' '0' '1' '1' '0' '1' '0'
'7' '1' '0' '0' '0' '1' '1' '1'
'0' '0' '2' '1' '2' '0' '3' '1'
'4' '0' '1' '0' '2' '0' '2' '0'
I want to do this without any 'for' because my cell arrays are too big. And I can't concat them manually because I never know the size.
Is there anyway I can do this using some function like cell fun ?
Thanks.

Best Answer

kdata_combined = cell2mat(kdata)