External Interfaces/API    

Using an Open MATLAB

You can make a MATLAB engine program use a MATLAB that is already open by starting that MATLAB with the /Automation command line argument. This causes the engOpen call to connect to a session of MATLAB that is already running. However, it will cause all engOpen calls to connect to that MATLAB session, so it will only work for one instance. If you want to do this with two sessions of MATLAB, they would both connect.

The /Automation argument also causes the command window to be minimized. You must open it manually.

For example

  1. Shut down any MATLAB.
  2. From the Start button on windows menu bar click Run.
  3. In the Open field type:

    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

    This does not start another MATLAB process, but rather uses the MATLAB process that is already open.


 Calling MATLAB From a Fortran Application Compiling and Linking Engine Programs