Calling / running m-file using Spreadsheet Link

5 visualizaciones (últimos 30 días)
hhjh
hhjh el 26 de Sept. de 2011
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

Respuestas (1)

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

Categorías

Más información sobre Data Import from MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by