필터 지우기
필터 지우기

Exporting uneven nested cells to excel

조회 수: 6 (최근 30일)
aaammm
aaammm 2023년 3월 3일
댓글: aaammm 2023년 3월 10일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by