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
2011년 9월 26일
0 개 추천
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에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!