Using Matlab to automate excel calculations
조회 수: 16 (최근 30일)
이전 댓글 표시
I have a legacy excel sheet that I need to run a large number of calulations through. The spreadsheet has a number of input cells (I only need to vary two keeping the other constant) And a output section, when the excel sheet is open, changing a value in the input section causes the excel sheet to immediately update with the new values. I need to run through a couple hundred sets of input values and would rather not copy and paste results all day. Is there a clever way to get Matlab to open the excel calulator, change the input values according to an array, read the output cells and store them in Matlab? My concern is that when using the normal excel import functions the output values will not change with the varying inpout values while accessing the sheet from another program.
VBA must be able to do this but I am much more familiar with Matlab and am on a bit of a time crunch so learning VBA will have to wait to another day. Thanks!
댓글 수: 1
Shubham Gupta
2019년 6월 27일
편집: Shubham Gupta
2019년 6월 27일
I think if you update spreadsheet's input then output is also updated according to the formula used in spreadsheet to obtain the output.
To test this theory, I have put some number in 'A1' of spreadsheet and some other number in 'A2'. Then, I created a fomula (which involved 'A1' and 'A2') in 'A3' to obtain an output. Now, when I try to update 'A1' or 'A2', 'A3' gets updated automatically according to the formula.
I tried following code to update 'A1' of the spreadsheet :
xlswrite('test.xlsx',5,1,'A1')
Then to read the spreadsheet I used :
xlsread('test.xlsx',1)
I am not sure if this answers your question, but I hope it helps !
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!