MATLAB: Split comma-separated rows into separate columns

MATLAB

hey i want to know how to split comma-separated rows into separate columns in cell array elements e.g.
x{4×1 cell}
x{1,1}{1,1}=[2,1,2,3]
& all other elements in this form.
result should be like this:
result{1,1}{1,1}=[2;1;2;3]
thanks in advance

Best Answer

>> Z = cellfun(@(c)cellfun(@(v)v(:),c,'uni',0),x,'uni',0)
Z =
{1x1 cell}
>> Z{1}{1}
ans =
2
1
2
3
Although your code would be a lot simpler if you did not use nested cell arrays in the first place.