how can i add results in the same excel sheet by running the same program for different inputs

4 visualizzazioni (ultimi 30 giorni)
I have stored the array of results (5 different variables) in 5 spreadsheets within same file name. I need to run the same program with different input and want to store the results each time in next row of the same excel sheets.
There are 5 worksheets with different names within same workbook file
Please help
  1 Commento
dpb
dpb il 23 Lug 2017
So what have you done so far and where did you specifically have trouble? Use sprintf or num2str to help in building a cell reference and sheet name or number; it's easiest if Matlab hasn't done it yet to write a simple helper function that returns an Excel address to be able to use repetitively instead of inline every time.

Accedi per commentare.

Risposte (1)

Image Analyst
Image Analyst il 23 Lug 2017
Unless you want to use ActiveX to ask Excel for the last row in a specified column, you'll have to have a 5 element array to keep track of the last row that got written to in each worksheet. Or equivalently, keep track of the next row to use for each worksheet.
If you've used ActiveX before, or want to know how, start with my attached demo.
  1 Commento
dpb
dpb il 23 Lug 2017
Or, if this is happening all at once, just accumulate all the data in memory and then write it all to the appropriate worksheet at the end.
Or, B) the "deadahead, braindead" way, read the data and append then write back out.
Your way is much more elegant, IA, of course... :)

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by