Start a MATLAB engine session
Fortran Syntax
integer*4 function engOpen(startcmd)
integer*4 ep
character*(*) startcmd
Arguments
ep
Engine pointer.
startcmd
Character
array to start MATLAB process.
Description
This routine allows you to start a MATLAB process for the purpose of using MATLAB as a computational engine.
engOpen(startcmd)
starts a MATLAB process using the command specified in startcmd
, establishes a connection, and returns a unique engine identifier, or 0 if the open fails.
On the UNIX system, if startcmd
is empty, engOpen
starts MATLAB on the current host using the command matlab
. If startcmd
is a hostname, engOpen
starts MATLAB on the designated host by embedding the specified hostname string into the larger string:
"rsh hostname \"/bin/csh -c 'setenv DISPLAY\
hostname:0; matlab'\""
If startcmd
is anything else (has white space in it, or nonalphanumeric characters), it is executed literally to start MATLAB.
engOpen
performs the following steps:
- 1
. - Creates two pipes.
- 2
. - Forks a new process and sets up the pipes to pass stdin and stdout from the
child to two file descriptors in the parent.
- 3
. - Executes a command to run MATLAB (
rsh
for remote execution).
Example
See fengdemo.f
in the eng_mat
subdirectory of the examples
directory for a sample program that illustrates how to call the MATLAB engine functions from a Fortran program.
[ Previous | Help Desk | Next ]