| MATLAB® | ![]() |
A handle to a MATLAB engine object.
Engine is a C language opaque type.
You can call MATLAB software as a computational engine by writing C and Fortran programs that use the MATLAB engine library, described in MATLAB Engine. Engine is the link between your program and the separate MATLAB engine process.
The header file containing this type is:
#include "engine.h"
The example engwindemo.c (in your matlabroot/extern/examples/eng_mat directory) shows how to plot position versus time for a falling object in a MATLAB figure window.
The engOpen function starts the MATLAB process, returning an Engine variable. You use this handle for all calls to the MATLAB workspace.
The mxCreateDoubleMatrix function creates an mxArray named T. The C function memcpy copies your time data (initialized in engwindemo.c) into T.
The engPutVariable function puts T into the MATLAB workspace. Now you can use this variable to calculate distance D. The engEvalString function evaluates the expression D = .5.*(-9.8).*T.^2.
Next, various MATLAB plot functions, like plot(T,D), display the graph.
Calls to the engClose and mxDestroyArray functions complete the procedure.
Other sample programs, also found in your matlabroot\extern\examples\eng_mat directory, that show you how to use Engine are:
engdemo.c shows how to call the MATLAB engine functions from a C program.
engwindemo.c show how to call the MATLAB engine functions from a C program for Windows systems.
fengdemo.F shows how to call the MATLAB engine functions from a Fortran program.
![]() | engGetVisible (C) | engOpen (C and Fortran) | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |