Main Content

engOpen (Fortran)

StartMATLABengine session

Fortran Syntax

#include "engine.h" mwPointer engOpen(startcmd) character*(*) startcmd

Description

engOpenstarts a MATLAB®process for using MATLAB as a computational engine.

WindowsPlatforms

engOpenlaunches 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 seeRegister MATLAB as a COM Server.

UNIXPlatforms

On UNIX®systems,engOpen:

  1. Creates two pipes.

  2. Forks a new process. Sets up the pipes to passstdinandstdoutfrom MATLAB (parent) software to two file descriptors in the engine program (child).

  3. Executes a command to run MATLAB software (rshfor remote execution).

Input Arguments

expand all

MATLAB startup command, specified ascharacter*(*).

On Windows®systems, thestartcmdstring must beNULL.

On UNIX systems:

  • IfstartcmdisNULLor the empty string, thenengOpenstarts a MATLAB process on the current host using the commandmatlab. Ifstartcmdis ahostname, thenengOpenstarts a MATLAB process on the designated host by embedding the specifiedhostnamestring into the larger string:

    "rsh hostname \"/bin/csh -c 'setenv DISPLAY\ hostname:0; matlab'\""
  • Ifstartcmdis any other string (has white space in it, or nonalphanumeric characters), then MATLAB executes the string literally.

Output Arguments

expand all

Handle to MATLAB engine, specified asmwPointer. ReturnsNULLif the open fails.

Examples

See these examples inmatlabroot/extern/examples/eng_mat:

Version History

Introduced before R2006a