engOpen (C) - Start MATLAB engine session - MATLAB (original) (raw)
Main Content
Start MATLAB engine session
C Syntax
#include "engine.h" Engine *engOpen(const char *startcmd);
Description
engOpen
starts a MATLAB® process for using MATLAB as a computational engine.
Windows Platforms
engOpen
launches MATLAB without a desktop.
The function opens a COM channel to MATLAB. The MATLAB software you registered during installation starts. If you did not register during installation, then see Register MATLAB as a COM Server.
UNIX Platforms
On UNIX® systems, engOpen
:
- Creates two pipes.
- Forks a new process. Sets up the pipes to pass_
stdin
_ andstdout
from MATLAB (parent) software to two file descriptors in the engine program (child). - Executes a command to run MATLAB software (
rsh
for remote execution).
Input Arguments
MATLAB startup command, specified as const char *
.
On Windows® systems, the startcmd
string must beNULL
.
On UNIX systems:
- If
startcmd
isNULL
or the empty string, thenengOpen
starts a MATLAB process on the current host using the commandmatlab
. Ifstartcmd
is ahostname
, thenengOpen
starts a MATLAB process on the designated host by embedding the specifiedhostname
string into the larger string:
"rsh hostname "/bin/csh -c 'setenv DISPLAY\
hostname:0; matlab'"" - If
startcmd
is any other string (has white space in it, or nonalphanumeric characters), then MATLAB executes the string literally.
Output Arguments
Handle to MATLAB engine, specified as Engine *
. ReturnsNULL
if the open fails.
Examples
To open an example, type:
edit([fullfile(matlabroot,"extern","examples","engmat","filename")]);
where filename
is:
- engdemo.c for a C example on UNIX operating systems.
- engwindemo.c for a C example on Microsoft® Windows operating systems.
Version History
Introduced before R2006a