Calling / running m-file using Spreadsheet Link
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
owr
le 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 commentaires
Voir également
Catégories
En savoir plus sur Data Import from MATLAB dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!