External Interfaces Previous page   Next Page

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:

  1. Shut down any MATLAB sessions.
  2. From the Start button on the Windows menu bar, click Run.
  3. In the Open field, type
  1. where d:\matlab\bin\win32 represents the path to the MATLAB executable.

  1. Click OK. This starts MATLAB.
  2. In MATLAB, change directories to $MATLAB/extern/examples/eng_mat, where $MATLAB is the MATLAB root directory.
  3. Compile the engwindemo.c example.
  4. Run the engwindemo program by typing at the MATLAB prompt
  1. This does not start another MATLAB session, but rather uses the MATLAB session that is already open.


Previous page  Calling MATLAB from a Fortran Application Compiling and Linking Engine Programs Next page

© 1994-2005 The MathWorks, Inc.