MATLAB: How to Unnest Nested cell arrays

arraycellcellsembedembeddedforloopnestnestedunnestunnesting

Hello, I have a 17×300 cell array, some of which contain text and numbers. However, the 17th column is filled with 1×1 cell arrays with a number inside. How do I unnest these unnested cells?

Best Answer

Given your array X:
X(:,17) = vertcat(X{:,17});
Note that this will only work if all of the cells in that column contain cell arrays. It will cause an error if any cell in the column contains any other data type.