Use Prebuilt MATLAB Interface to C++ Library
To call a function in a C++ library, use the MATLAB®
clib
namespaceIf you have a published MATLAB interface to a C++ shared library, then you can use these classes and functions directly in MATLAB, passing data back and forth between MATLAB and C++.
Functions
clibArray | Create MATLAB clib array for C++ library functions |
clibConvertArray | Convert MATLAB fundamental or struct array to MATLAB array of C++ objects |
clibConfiguration | Set run-time configuration parameters for C++ library interface (Since R2023a) |
CLibraryConfiguration | C++ library interface environment information (Since R2023a) |
clibIsNull | Determine if C++ object is null |
clibIsReadOnly | Determine if C++ object is read-only |
clibRelease | Release C++ object from MATLAB |
underlyingValue | Underlying numeric value for C++ enumeration object created in MATLAB |
Topics
Configure C++ Library Interface
- 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.
Use C++ Library in MATLAB
- 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
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.