Error using writecell: Nested cell arrays are not supported.
64 views (last 30 days)
Show older comments
Hi all,
I have a cell and i want to export it as Excell, so i use "writecell" function. Unfortunately I am getting an error like below:
Error using writecell
Nested cell arrays are not supported.
How can i fix it?
Thank you for your answers.
Cem
0 Comments
Accepted Answer
Sivsankar
on 6 Jun 2023
The error message "Nested cell arrays are not supported" indicates the reason for the writecell error is due to the presence of nested cell arrays in the data you are trying to export.
You can fix this by converting the nested cell arrays into regular arrays or cells without any nesting. There are different ways to do this depending on the structure of your data. Here is a possible solution:
->Flatten the nested cell array: You can use the cell2mat function to convert the nested cell array into a regular array, as shown below:
data = {[1 2 3], [4 5 6; 7 8 9]};
flattenedData = cell2mat(data);
writecell(flattenedData, 'myfile.xlsx');
Note: Dont mind my use case data. I guess this shpuld not give that error anymore. Thanks!
0 Comments
More Answers (0)
See Also
Categories
Find more on Cell Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!