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

1 view (last 30 days)
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.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
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>

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Products


Release

R2009a

Community Treasure Hunt

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

Start Hunting!