Main Content

Call MATLAB from C++

Run MATLAB® code from C++ programs, with object-oriented programming support and asynchronous execution

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++ uses the MATLAB Data API for C++, which provides a way for applications running outside of MATLAB to work with MATLAB data through a MATLAB-neutral interface.

Share MATLAB Session

matlab.engine.shareEngineConvert running MATLAB session to shared session

Start, Find, Connect, and Terminate MATLAB

matlab::engine::connectMATLABConnect to shared MATLAB session synchronously
matlab::engine::connectMATLABAsyncConnect to shared MATLAB session asynchronously
matlab::engine::findMATLABFind shared MATLAB sessions synchronously
matlab::engine::findMATLABAsyncFind shared MATLAB sessions asynchronously
matlab::engine::startMATLABStart MATLAB synchronously
matlab::engine::startMATLABAsyncStart MATLAB asynchronously
matlab::engine::terminateEngineClientFree engine resources during runtime

Type Conversions

matlab::engine::convertUTF8StringToUTF16StringConvert UTF-8 string to UTF-16 string
matlab::engine::convertUTF16StringToUTF8StringConvert UTF-16 string to UTF-8 string

Type Definitions

matlab::engine::StreamBuffer Define stream buffer
matlab::engine::String Define UTF16 string

Classes

matlab::engine::MATLABEngineEvaluate MATLAB functions from C++ program
matlab::engine::FutureResultRetrieve result from asynchronous operation
matlab::engine::SharedFutureResult Retrieve result from asynchronous operation as shared future
matlab::engine::WorkspaceTypeType of MATLAB workspace

Generate C++ Code Interface

matlab.engine.typedinterface.generateCPPGenerate C++ code interface for MATLAB packages, classes, and functions

Themen

Setup and Build Engine Applications

Start and Connect to MATLAB

Call Functions and Exchange Data

Create MATLAB Data Types

Strongly Typed Interface

Verwandte Informationen