The MATLAB Engine API for C++ provides an interface between the C++ programming language and MATLAB. This API enables C++ programs to launch MATLAB, evaluate MATLAB functions with arguments, and exchange data between MATLAB and C++ programs.
The MATLAB Engine API for C++ supports the MATLAB Data API, which provides a way for applications running outside of MATLAB to work with MATLAB data through a MATLAB-neutral interface. For more information on the MATLAB Data API, see MATLAB Data API.
Introduction to Engine API for C++
Introduction to the basic design of a C++ engine program.
Build engine applications on different platforms.
Use this sample code to confirm your development environment for the MATLAB Engine API for C++.
The MATLAB Engine C++ API comprises functions, classes, and typedefs in matlab::engine
namespace.
Start MATLAB Sessions from C++
Start and connect to a MATLAB session synchronously and asynchronously from C++.
Connect C++ to Running MATLAB Session
Connect the C++ engine to a MATLAB session that has been started as or converted to a shared session.
Call MATLAB Functions from C++
Call MATLAB functions from C++, passing variable to MATLAB and returning variables to C++.
Evaluate MATLAB Statements from C++
Evaluate MATLAB expression from C++ and write variables into the MATLAB base workspace.
Pass Variables from C++ to MATLAB
Pass variables from C++ to MATLAB as function arguments or by placing those variables directly in the MATLAB base workspace.
Pass Variables from MATLAB to C++
Get variables from the MATLAB base or global workspace.
Redirect MATLAB Command Window Output to C++
Redirect MATLAB command window output, including error messages, to you C++ program.
Run Simulink Simulation from C++
Run Simulink® model simulations from C++ and visualize the results with MATLAB graphics.
Convert C++ Engine Application to MATLAB Compiler SDK Application
How to convert an engine application to a deployed application using MATLAB Compiler SDK™.
Create Structure Arrays from C++
Create a structure array in C++ and pass it to MATLABor get a structure array defined in MATLAB.
Create heterogeneous arrays in C++ to use as MATLAB cell arrays.
Pass Enumerations to MATLAB From C++
Pass enumeration members of MATLAB enumeration classes to MATLAB from C++.
Pass Sparse Arrays to MATLAB From C++
Pass arrays to MATLAB as MATLAB sparse arrays.