Struct with multiple rows to excel file with one sheet per row

1 view (last 30 days)
Hello,
I'm working with structure and I would like to save the data into one excel file.
My structure is composed on 77 rows, each row is a 2D table that I output as a single Excel sheet in an Excel workbook.
I'm looping over each row for the moment but the problem is the code is quite slow, and the more rows I have, the longer is my saving.
My saving code is the following :
for i = 1:77
Data = struct2table(Data_struct(i));
writetable(Data,filename,'sheet',i);
end
It works well but I would like to speed it up. It took minimum 3 seconds to save one sheet and obviously it increases when the file grow up. Is there a way to save it without a loop ? Or save only one time ?
For a file of 4MB and 77 sheets it takes more than 5 minutes
Thank you
  2 Comments
Aymeric Ferreira
Aymeric Ferreira on 30 Dec 2019
Edited: Aymeric Ferreira on 30 Dec 2019
Thank you for your answer, you can find attached an example of Data_struct.mat

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by