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.

 Réponse acceptée

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>

Plus de réponses (0)

Catégories

Produits

Version

R2009a

Community Treasure Hunt

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

Start Hunting!

Translated by