I have used regexp to find some numbers in each element of a cell array. However, the result of the regexp is a nested cell array such as the following:
>> celldisp(a)a{1}{1}{1} =5a{2}{1}{1} =36
All I want is to have the result collapsed into the simple numerical array [5 36] but I have been unable to get the right syntax.I have tried things like the following but the nesting seems to cause issues:
>> b=[a{:}{1}{1}]Expected one output from a curly brace or dot indexing expression, but there were 2 results. >> b=cell2mat(a{:}{1}{1})Expected one output from a curly brace or dot indexing expression, but there were 2 results. >> b=cell2mat(a)Error using cell2mat (line 52)CELL2MAT does not support cell arrays containing cell arrays or objects.
I could certainly use a loop to iterate through it, but it seems like there should be some very simple syntax that does the trick.
Best Answer