Contents

Introducing MATLAB Engine

The MATLAB® engine library contains routines that allow you to call MATLAB software from your own programs, thereby employing MATLAB as a computation engine. You must use an installed version of MATLAB; you cannot run the MATLAB engine on a machine that only has the MATLAB Compiler Runtime (MCR).

Engine programs are standalone C/C++ or Fortran programs that communicate with a separate MATLAB process via pipes, on UNIX® systems, and through a Microsoft® Component Object Model (COM) interface, on Microsoft Windows® systems. MATLAB provides a library of functions that allows you to start and end the MATLAB process, send data to and from MATLAB, and send commands to be processed in MATLAB.

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/C++ and the back end (analysis) is programmed in MATLAB, which can shorten 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 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. For more information, see the engOpen reference page.

  • Instead of requiring your program to link to the entire MATLAB program (a substantial amount of code), it links to a smaller engine library.

The MATLAB engine cannot read MAT-files in a format based on HDF5. These are MAT-files saved using the -v7.3 option of the save function or opened using the w7.3 mode argument to the C or Fortran matOpen function.

    Note:   To run MATLAB engine on the UNIX platform, you must have the C shell csh installed at /bin/csh.

Communicating with MATLAB Software

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 MATLAB COM Integration.

Was this topic helpful?