External Interfaces/API |
|
Attaching to an Existing MATLAB Session
You can make a MATLAB engine program attach to a MATLAB session that is already running by starting the MATLAB session with /Automation
in the command line. When you make a call to engOpen
, it will then connect to this existing session. You should only call engOpen
once, as any engOpen
calls will now connect to this one MATLAB session.
The /Automation
option also causes the command window to be minimized. You must open it manually.
For example:
- Shut down any MATLAB sessions.
- From the Start button on the Windows menu bar, click Run.
- In the Open field, type
- where
d:\matlab\bin\win32
represents the path to the MATLAB executable.
- Click OK. This starts MATLAB.
- In MATLAB, change directories to
$MATLAB/extern/examples/eng_mat
, where $MATLAB
is the MATLAB root directory.
- Compile the
engwindemo.c
example.
- Run the
engwindemo
program by typing at the MATLAB prompt
- This does not start another MATLAB session, but rather uses the MATLAB session that is already open.
Note
On the UNIX platform, you cannot make a MATLAB engine program use a MATLAB session that is already running.
|
| Calling MATLAB From a Fortran Application | | Compiling and Linking Engine Programs | |