how can i add results in the same excel sheet by running the same program for different inputs
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
dpb
2017-7-23
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.
回答(1 个)
Image Analyst
2017-7-23
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 个评论
dpb
2017-7-23
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... :)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 ActiveX 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!