| MATLAB® | ![]() |
| On this page… |
|---|
Some of the things you can do with the MATLAB® engine are
Call a math routine, for example, to invert an array or to compute an FFT from your own program. When employed in this manner, MATLAB is a powerful and programmable mathematical subroutine library.
Build an entire system for a specific task, for example, radar signature analysis or gas chromatography, where the front end (GUI) is programmed in C and the back end (analysis) is programmed in MATLAB, thereby shortening development time.
The MATLAB engine operates by running in the background as a separate process from your own program. This offers several advantages:
On UNIX®[1] systems, the engine can run on your machine, or on any other UNIX machine on your network, including machines of a different architecture. This allows you to implement a user interface on your workstation and perform the computations on a faster machine located elsewhere on your network. The description of the engOpen function offers further information.
Instead of requiring your program to link to the entire MATLAB program (a substantial amount of code), it links to a smaller engine library.
Note To run MATLAB engine on the UNIX platform, you must have the C shell csh installed at /bin/csh. |
The engine library contains the following routines for controlling the computation engine. The names begin with the three-letter prefix eng.
C Engine Routines
| Function | Purpose |
|---|---|
Start up MATLAB engine | |
Shut down MATLAB engine | |
Get a MATLAB array from the engine | |
Send a MATLAB array to the engine | |
Execute a MATLAB command | |
Create a buffer to store MATLAB text output | |
Start a MATLAB engine session for single, nonshared use | |
Determine visibility of MATLAB engine session | |
Show or hide MATLAB engine session |
Fortran Engine Routines
| Function | Purpose |
|---|---|
Start up MATLAB engine | |
Shut down MATLAB engine | |
Get a MATLAB array from the engine | |
Send a MATLAB array to the engine | |
Execute a MATLAB command | |
The engine also uses the mx–prefixed API routines discussed in Creating C Language MEX-Files and Creating Fortran MEX-Files.
On UNIX systems, the engine library communicates with the engine using pipes, and, if needed, rsh for remote execution. On Microsoft® Windows® systems, the engine library communicates with the engine using a Component Object Model (COM) interface. For more information, see COM Support for MATLAB® Software.
If you have graphical user interface (GUI) intensive applications that execute a lot of callbacks through the MATLAB engine, you should force these callbacks to be evaluated in the context of the base workspace. Use evalin to specify that the base workspace be used in evaluating the callback expression, as follows:
engEvalString(ep, "evalin('base', expression)")Specifying the base workspace in this manner ensures MATLAB processes the callback correctly and returns results for that call.
This does not apply to computational applications that do not execute callbacks.
[1] UNIX is a registered trademark of The Open Group in the United States and other countries.
![]() | Calling MATLAB® Software from C and Fortran Programs | Examples of Calling Engine Functions | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |