Calling / running m-file using Spreadsheet Link
5 views (last 30 days)
Show older comments
Hi,
Recently I started using the Spreadsheet Link, which works nicely in order to transfer data between Excel and Matlab.
However, this is the case: I created a MATLAB m-file which needs 2 matrices as input, let's say A and B. The VBA macro I wrote for this is:
MLPutMatrix "A", Sheets("Sheet1").Range("D2:AV17") MLPutMatrix "B", Sheets("Sheet2").Range("A1:F20")
This works great. Now I have to run a mfile (lets say solver.m). This one takes pretty much time (> 2 hours) and uses external solvers: CPLEX / Gurobi by Tomlab.
The result of this mfile is the matrix "planningfinal".
I want to load this to Excel, and it works via:
MLGetMatrix "planningfinal", "Sheet3!A1" MatlabRequest
The question however, is how to call / run this mfile (solver.m) from the VBA code, and after it is finished return the output (planningfinal).
Looking forward to your help!
Warm regards,
Bart
0 Comments
Answers (1)
owr
on 26 Sep 2011
See the function "MLEvalString" in the docs. Works just like Put/Get Matrix and is meant to do exactly what you need.
0 Comments
See Also
Categories
Find more on Data Import from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!