使用预置的 MATLAB C++ 库接口
要调用 C++ 库中的函数,请使用 MATLAB®
clib
命名空间如果您有已发布的对接 C++ 共享库的 MATLAB 接口,则可以直接在 MATLAB 中使用这些类和函数,从而在 MATLAB 和 C++ 之间来回传递数据。
函数
clibArray | 为 C++ 库函数创建 MATLAB clib 数组 |
clibConvertArray | 将 MATLAB 基本数组或结构体数组转换为 C++ 对象的 MATLAB 数组 |
clibConfiguration | Set run-time configuration parameters for C++ library interface (自 R2023a 起) |
CLibraryConfiguration | C++ library interface environment information (自 R2023a 起) |
clibIsNull | 确定 C++ 对象是否为空 |
clibIsReadOnly | 确定 C++ 对象是否为只读 |
clibRelease | 从 MATLAB 中释放 C++ 对象 |
underlyingValue | 在 MATLAB 中创建的 C++ 枚举对象的基础数值 |
主题
配置 C++ 库接口
- Set Run-Time Library Path for C++ Interface
If the C++ library has a compiled library file, then that file and its dependencies must be on your system path or run-time search path (rpath). - Load C++ Library In-Process or Out-of-Process
Execute C++ functions in processes that are the same as or separate from the MATLAB process. - Display Help for MATLAB Interface to C++ Library
Display information about the members of MATLAB interface.
在 MATLAB 中使用 C++ 库
- Call Functions in C++ Compiled Library
To call a function in the library, use the MATLAB
clib
namespace. - Pass clib.array to C++ Functions
The term clib array is the MATLAB object representation of C++ native arrays andstd::vector
types. - Create MATLAB Array of C++ Objects
CallclibArray
to create MATLAB clib array for C++ library functions. - MATLAB Type to C++ Type Mapping
When you pass MATLAB data as arguments to C++ methods or functions, MATLAB converts the data into types that best represent the data to the C++ language. - C++ Names That Are Invalid in MATLAB
How MATLAB handles C++ names that are invalid MATLAB names. - Use C++ Objects and Functions in parfor Loops
How to take advantage of parallel computing resources using a MATLAB interface to a C++ compiled library.
疑难解答
Troubleshooting MATLAB Interface to C++ Library Run-Time Issues
Resolve unexpected run-time errors when calling functions in a published MATLAB interface to a C++ shared library.
Troubleshooting Calls to C++ Library Functions
Resolve unexpected issues when calling functions in a C++ shared library.
C/C++ library features not supported in MATLAB.
Using C++ exceptions in MATLAB.