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
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
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
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 CenterFile Exchange에서 ActiveX에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by