Can MATLAB be used to call excel, calculate outputs, and place back into MATLAB Workspace iteratively in for loop?

26 views (last 30 days)
Hi!
I have an excel spreadsheet that has been provided to me that has 15 input variables and an output. The 15 input variables are all interlated and affect whether the output works or not. So now I am trying to figure out essentially the ranges that will work for each input variable once you've modified another input variable.
My hope and plan is using Spreadsheet Link, write a brute force method in MATLAB defining all of input variables with best guess ranges and then using combvec() to generate every possible configuration of those input variables. Once I've created the combo matrix I would run through every combination using a for loop for the length of the combo matrix. Within this for loop it would call the excel spreadsheet, input the variables defined for that combo, calculate and determine if the output is a number or produces an error, return that output to MATLAB to then be stored in a Pass/Fail vector. Once I have that I could determine a reasonable range for each input variable.
Issue is that no one knows how the excel is calculating the outputs. The above method seemed liek a quick way to get some good results.
I've been watching videos to see if other have tried something like this before. https://www.mathworks.com/videos/matlab-integration-with-excel-1626852365127.html
Is this a possible solution? If not is there another method that may work better?
Thank you!

Answers (1)

Walter Roberson
Walter Roberson on 1 Nov 2024 at 19:37
Spreadsheet Link is for running MATLAB from within Excel, but you want the opposite, to run Excel from within MATLAB.
Running Excel from within MATLAB is possible using actxserver . It can be a bit of a nuisance to set everything up properly, but possible.

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!