与 C++ 应用程序的数据交换和映射
从 C++ 应用程序与 MATLAB 数据交互
使用 C++ Engine API 和 MATLAB Data API for C++ 在 C++ 程序和 MATLAB® 函数之间传递数据的示例。
使用强定型接口在 MATLAB 和 C++ 之间强制执行严格的数据类型映射。调用 matlab.engine.typedinterface.generateCPP
函数为 MATLAB 函数和类生成 C++ 头文件。然后,当您使用这些头文件编译 C++ 应用程序时,您可以将 MATLAB 函数和类用作 C++ 函数和类,而无需编写 C++ 代码。
函数
主题
创建 MATLAB 数据类型
- Create Structure Arrays from C++
Create structure arrays in C++ and pass to MATLAB or get structure arrays defined in MATLAB. - Create Cell Arrays from C++
Create heterogeneous arrays in C++ to use as MATLAB cell arrays. - Pass Enumerations to MATLAB from C++
Pass members of a MATLAB enumeration class to MATLAB from C++. - Pass Sparse Arrays to MATLAB from C++
Pass arrays to MATLAB as MATLAB sparse arrays. - Use MATLAB Handle Classes in C++
Integrate MATLAB handle classes with C++ applications.
强定型接口
- What Is Strongly Typed Interface for C++?
The C++ MATLAB Data API interface supports strongly typed MATLAB code. - Write MATLAB Code for Strongly Typed C++ Interface
Specify data type requirements in MATLAB code. - Create C++ Header File from Strongly Typed MATLAB Function
Integrate a MATLAB Data API C++ header file from a strongly typed MATLAB function with C++ application code that calls MATLAB. - Data Type Mappings Between C++ and Strongly Typed MATLAB Code
Refer to data type mappings between C++ and MATLAB when using strongly typed MATLAB code. - Limitations of Strongly Typed Interface for C++
Strongly typed interface for C++ features not supported in MATLAB.
疑难解答
MATLAB Engine API for C++ Exception Classes
The MATLAB engine API for C++ defines specific exception classes for MATLAB.