Error using writecell: Nested cell arrays are not supported.
64 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Sivsankar
il 6 Giu 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Cell Arrays in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!