# Export nested cell array to excel

6 Ansichten (letzte 30 Tage)
aaammm am 16 Mär. 2023
Bearbeitet: Vilém Frynta am 16 Mär. 2023
I have a nested cell array where each cell has three columns but different number of rows. I need to export the values to excel keeping the columns intact but using writecell gives me an error 'Nested cell arrays are not supported'. How can I export the values to excel?
Here's a quick example:
A1 = {1,1,1};
A2 = {2,2,2;2,2,2};
A3 = {3,3,3;3,3,3;3,3,3;};
A = {A1, A2, A3};
writecell(A, 'mydata.xlsx');
Error using writecell
Nested cell arrays are not supported.
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Antworten (1)

Vilém Frynta am 16 Mär. 2023
Bearbeitet: Vilém Frynta am 16 Mär. 2023
You could just try to avoid using the cells, and just create one big matrix (array) with NaNs and then fill in your data. However, this would be an easy workaround just in case you have just these few columns and numbers. If you have much more numbers and columns, it could be bit trickier.
See my example:
m = NaN([3 6])
m = 3×6
NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
m(1:3,1) = [1 1 1]
m = 3×6
1 NaN NaN NaN NaN NaN 1 NaN NaN NaN NaN NaN 1 NaN NaN NaN NaN NaN
... and go on.
Hope I helped.
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Find more on Spreadsheets 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!

Translated by