Q: Nested Cell to string I have the following problem: 
Objective (high-level): 
I would like to convert ESRI Shapefiles into SQL spatial data. For that purpose, I need to adapt the synthax. 
Current status / problem:
I constructed a the following cell array:
'MULTIPOLYGON('    {1x2332 cell}    ','    {1x916 cell}    ','    {1x391 cell}    ','    {1x265 cell}    ')'

with in total 9 fields. This cell array contains the following 'nested' cell arrays: {1x2332 cell}, {1x916 cell}, {1x391 cell}, {1x265 cell}. As an example, 'nested' cell {1x2332 cell} has the following form:
'(('    [12.714606000000000]    [42.155628000000000]    ','    [12.702529999999999]    [42.152873999999997]    ',' ... ','    [12.714606000000000]    [42.155628000000000]    '))'

However, I would like to have the entire cell array (including all 'nested cells') as one string without any spaces (except the space between the numbers (coordinates)). Would you have an idea how I could get to a solution?
Thank you in advance.

A: You probably need loops for this.
Consider a smaller example:
innerCell1 = {'((' [12.714606000000000] [42.155628000000000] ',' [12.702529999999999] [42.152873999999997] ',' [12.714606000000000] [42.155628000000000] '))'};
outerCell = {'MULTIPOLYGON(' innerCell1 ',' innerCell1 ')'};

You can go along these lines:
outer = outerCell; %// will be overwritten
ind_outer = find(cellfun(@iscell, outer)); %// positions of inner cell arrays in `outer`
for m = ind_outer
    inner = outer{m};
    ind_inner = cellfun(@isnumeric, inner); %// positions of numbers in `inner`
    ind_inner_space = find(ind_inner(1:end-1) & ind_inner(2:end)); %// need space
    ind_inner_nospace = setdiff(find(ind_inner), ind_inner_space); %// don't need
    for n = ind_inner_space
        inner{n} = [num2str(inner{n}) ' ']; %// convert to string with space
    end
    for n = ind_inner_nospace
        inner{n} = num2str(inner{n}); %// convert to string, without space
    end
    outer{m} = [inner{:}]; %// concatenate all parts of `inner`
end
str = [outer{:}]; %// concatenate all parts of `outer`

This results in the string
str =
MULTIPOLYGON(((12.7146 42.1556,12.7025 42.1529,12.7146 42.1556)),((12.7146 42.1556,12.7025 42.1529,12.7146 42.1556)))

