Saving output in different rows with subsequent runs of my program.

5 views (last 30 days)
I want to run my program multiple times, and during each run, I want to save data in a same Excel sheet but in the different new row such as
Run 1 output data in A1,
Run 2 output data in A2, and so on and so on.....
Currently my output data keep saving in same row (A1) and overwrites it after the next run. I hope someone can help to answer my problem. Thanks In advance.

Answers (1)

dpb
dpb on 29 Apr 2023
See the 'append' value for the 'WriteMode' named parameter in <writetable>.
Far more efficient would be to wrap your code as a function, then call it in a loop saving the output in an array locally, THEN write the output in "one swell foop" instead of opening/closing the file for every row.
  2 Comments
Aries
Aries on 30 Apr 2023
Edited: Aries on 30 Apr 2023
Thanks dpb in your suggestion and help. Will try yuor suggestion
Aries
Aries on 30 Apr 2023
Hi dpb,
It works, the data was saving in the different row every run of the program.
However the first row data follow the new data in the last row.
Any comment & suggestion.

Sign in to comment.

Categories

Find more on Characters and Strings 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!