How do I connect to the same MATLAB session from two different Scripts ?

I have a batch file that will start Matlab and run a simulink model to collect some data. Later I run another script that is supposed to stop the model and save the data to a MAT file.
The problem is that the second script starts a new instance(process) of Matlab and never performs the way it is expected.

 採用された回答

MathWorks Support Team
MathWorks Support Team 2009 年 6 月 27 日

0 投票

It is not possible to connect to the same MATLAB session from two different BAT scripts. Alternatively use WSH (Windows Script Host) scripting to connect to MATLAB as a COM server, and use another WSH script to connect to the same MATLAB.
Two attached scripts "startmatlab.vbs" and "stopmatlab.vbs" illustrate how to do this.
For information about WSH scripting refer to the following webpage:
<http://msdn.microsoft.com/en-us/library/9bbdkx3k(VS.85).aspx>
Information about MATLAB Automation server support can be found in the link below:
<http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/brd0v3w.html>

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeWireless Communications についてさらに検索

製品

リリース

R2009a

Community Treasure Hunt

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

Start Hunting!

Translated by