Exporting uneven nested cells to excel

5 Ansichten (letzte 30 Tage)
aaammm
aaammm am 3 Mär. 2023
Kommentiert: aaammm am 10 Mär. 2023
I have a 1x50 nested cell array where each cell has 3 columns but different number of rows that I need to export to excel.
I already have a loop to obtain the nested cell variable so I am using xlswrite('mydata.xlsx',data,'Sheet1') in the loop.
How can I move columns so the data is not overwritten in columns A:C for every iteration?
  1 Kommentar
Voss
Voss am 5 Mär. 2023
You can set the Range of cells to be written to (xlswrite(filename,A,sheet,xlRange)), which you would adjust on each iteration of the loop.
However, it's likely easier to write the entire file once, without a loop at all.
Can you save your cell array in a .mat file and upload it here (using the paperclip button), and also share any code you have written so far for this?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Swaraj
Swaraj am 6 Mär. 2023
Xlswrite is not recommended. Go through the below documentation.
You can go for “writecell” function. We can use it to specify range within which[JK1] we want to write data.
To avoid overwriting data in columns A:C for every iteration, you can use the Range input argument of the “writecell” function to specify the starting cell for each iteration
For example :
writecell(C,'C.xls','Sheet',2,'Range','A3:C5')
Go through the below documentation for further details.
  1 Kommentar
aaammm
aaammm am 10 Mär. 2023
I've already tried writecell and it doesn't work if the cells have different sizes. The longest column is also 105k rows

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by