I can convert a cell array of matrices to matrix:
>> C={[1,1]; [2,2]; [3,3]};
>> cell2mat(C)
ans =
1 1
2 2
3 3
This is OK. But, I want to convert a cell array including other cell arrays to a matrix:
>> C={{1,1}; {2,2}; {3,3}};
>> cell2mat(C)
Error using cell2mat (line 53)
Cannot support cell arrays containing cell arrays or objects.
So, desired output is:
>> mycell2mat({{1,1}; {2,2}; {3,3}})
ans =
1 1
2 2
3 3
How to do this?
Edit:
I want to do same thing for multidimensional ones also:
>> mycell2mat({{1,1;1,1}; {2,2;2,2}; {3,3;3,3}})
ans(:,:,1) =
1 1
1 1
ans(:,:,2) =
2 2
2 2
ans(:,:,3) =
3 3
3 3