Calling / running m-file using Spreadsheet Link

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

回答(1 个)

owr
owr 2011-9-26
See the function "MLEvalString" in the docs. Works just like Put/Get Matrix and is meant to do exactly what you need.

类别

帮助中心File Exchange 中查找有关 Data Import from MATLAB 的更多信息

提问:

2011-9-26

Community Treasure Hunt

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

Start Hunting!

Translated by