How to save for loop data to same excel file of variable?

2 Ansichten (letzte 30 Tage)
In my code for every for loop a output variable is calculated. So, I want to save the data of each loop in same sheet after the last line in excel. Is there any way to do so?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 1 Apr. 2018
If you are using MS Windows with Excel installed then see https://www.mathworks.com/matlabcentral/fileexchange/28600-xlsappend
However, I would recommend that you consider saving all of the results in an array and appending only once all of the values are known, as the communication with Excel is comparatively expensive.
  3 Kommentare
Parthiban Arumugam
Parthiban Arumugam am 18 Nov. 2022
could you please explain how to call this function (above link) ?
can you put some example code here, if possible ?
Walter Roberson
Walter Roberson am 18 Nov. 2022
In current releases I would use writetable or writematrix or writecell, with the option WriteMode 'append'

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Data Import from MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by