Exporting uneven nested cells to excel

6 次查看(过去 30 天)
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 个评论
Voss
Voss 2023-3-5
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?

请先登录,再进行评论。

回答(1 个)

Swaraj
Swaraj 2023-3-6
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 个评论
aaammm
aaammm 2023-3-10
I've already tried writecell and it doesn't work if the cells have different sizes. The longest column is also 105k rows

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by