How to execute a called

4 ビュー (過去 30 日間)
Gino
Gino 2013 年 3 月 6 日
I am calling an m file from a vb script (visual basic script) this works, i can open the file, but it doesn't run (probably because it isn't a exe file) So now my question is, how can I automatically have it running when i call it from my script. I am aware that it is possible to create an executable file with matlab, but i don't have the licenses necessary to do this Are there any other ways to do this?
the code from VBS:
_ Set wshShell = WScript.CreateObject("WSCript.shell")
wshshell.run "C:\Users\Gino\Documents\MATLAB\file.m"
set wshshell = Nothing_
If anyone could help, it would be much appreciated

採用された回答

Friedrich
Friedrich 2013 年 3 月 6 日
Hi,
you have two alternatives:
1.) Use MATLAB Automation Server from VBS
2.) Start MATLAB.exe with -r flag to run that script (maybe you also need -sd to start in the directory where the m file is located)

その他の回答 (1 件)

Gino
Gino 2013 年 3 月 8 日
Hi thank you for your answer It has already helped, however i can still only seem to open the m file (without running) or open the command window
Set MatLab = CreateObject("Matlab.Application") MatLab.Execute"C:\Users\Gino\Documents\MATLAB\test.m" Set Matlab = nothing (this program only opens the command window)
The problem is that i can't find any examples to base my solution on Would it be possible if someone could give me or has an example of the full syntax of 1 of the 2 solutions given above
  2 件のコメント
Friedrich
Friedrich 2013 年 3 月 12 日
Hi, sorry for the delay:
Set MatLab = CreateObject("Matlab.Application")
MatLab.Execute("cd('C:\Users\Gino\Documents\MATLAB')")
Matlab.Execute("test")
Hope that helps.
Gino
Gino 2013 年 3 月 18 日
Thank you sir, this works perfectly

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDownloads についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by