使用预置的 MATLAB C++ 库接口
clib
命名空间如果您有已发布的对接 C++ 共享库的 MATLAB 接口,则可以直接在 MATLAB 中使用这些类和函数,从而在 MATLAB 和 C++ 之间来回传递数据。
函数
clibArray | 为 C++ 库函数创建 MATLAB clib 数组 (自 R2020a 起) |
clibConvertArray | 将 MATLAB 数值数组转换为 C++ 对象数组 (自 R2020a 起) |
clibConfiguration | Change execution mode of C++ library interface (自 R2023a 起) |
CLibraryConfiguration | C++ library interface environment information (自 R2023a 起) |
clibIsNull | 确定 C++ 对象是否为空 |
clibIsReadOnly | 确定 C++ 对象是否为只读 |
clibRelease | 从 MATLAB 中释放 C++ 对象 |
underlyingValue | 在 MATLAB 中创建的 C++ 枚举对象的基础数值 |
主题
- Call Functions in C++ Compiled Library
To call a function in the library, use the MATLAB
clib
namespace. - Call Functions in Windows Interface to C++ Compiled Library
How to call functions in a Windows® interface to the
matrixOperations
C++ compiled library example. - Call Functions in Linux Interface to C++ Compiled Library
How to call functions in a Linux® interface to the
matrixOperations
C++ compiled library example. - 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 separate from the MATLAB process.
- Display Help for MATLAB Interface to C++ Library
Display information about the members of MATLAB interface.
- Represent C++ Arrays Using MATLAB Objects
How to create a MATLAB clib array or convert a MATLAB array to pass as a C++ function parameter.
- C++ Language Opaque Objects
How MATLAB handles opaque objects.
- C++ Names That Are Invalid in MATLAB
MATLAB automatically renames classes, member functions, non-member functions, and enumerations with C++ names that are invalid in MATLAB by using the
matlab.lang.makeValidName
function. - Use Function Type Arguments
How to pass function type arguments to C++ functions.
- Use Function and Member Function Templates
How to call and customize names of functions derived from C++ templates.
- 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.
- Limitations to C/C++ Support
C/C++ library features not supported in MATLAB.
- Handling Exceptions
Using C++ exceptions in MATLAB.
疑难解答
Troubleshooting MATLAB Interface to C++ Library Issues
MATLAB searches for the library interface file on the MATLAB path.