User`s manual

Examples of Calling Engine Functions
4-15
The program continues with
Type 0 <return> to Exit
Type 1 <return> to continue
Entering 1 at the prompt continues the program execution.
1
MATLAB computed the following distances:
time(s) distance(m)
1.00 -4.90
2.00 -19.6
3.00 -44.1
4.00 -78.4
5.00 -123.
6.00 -176.
7.00 -240.
8.00 -314.
9.00 -397.
10.0 -490.
Finally, the program frees memory, closes the MATLAB engine, and exits.
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.
Note For more information on the /Automation command line argument and
ActiveX in general, see “Introducing MATLAB ActiveX Integration” on
page 7-3.