MATLAB: Convert array of cells to array of doubles

cell arraysconvert data typesMATLAB

Hello,
I'm trying to convert an array of cells to an array of doubles. However the cell array is shaped a bit unfortunate, with unnecessary nesting:
northing_raw 51×1 cell
northing_raw{1,1} 1×1 cell
northing_raw{1,1}{1,1} 1×9 char
e.g.:
northing_raw{1,1}{1,1} = 5923991.9
Is there a way to avoid loops when I want to create a double array?
Best, Erik

Best Answer

I cannot say if the nesting is unnecessary, but since cells by definition can contain variables of different types and sizes, you would likely have to create each double array separately.
However, if you have several different matrices of the same sizes and data types, you can concatenate them into a single array, but that’s the best you can hope for.
You will likely also have to loop through them.