Error using writecell: Nested cell arrays are not supported.
62 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Sivsankar
2023 年 6 月 6 日
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!