Use C++ MEX to create MATLAB functions that provide the efficiency of C++ programs and that can access external functions and libraries from MATLAB.
The C++ MEX API provides these features:
Use modern C++ programming features and object-oriented designs.
Get inputs from MATLAB.
Return results to MATLAB.
Support MATLAB data types and copy-on-write semantics.
Call MATLAB functions from the MEX function.
Integrate seamlessly into MATLAB.
Implement a class that overrides the function call operator
() to create a functor object.
Techniques to avoid making copies of large arrays to reduce memory usage and improve execution speed.
MexFunction class to better handle the
resources used by your MEX function.
Check the size and type of inputs and display error messages in MATLAB.
MEX functions can display output in the MATLAB command window.
Call MATLAB functions, passing arguments from and returning arguments to a MEX function.
Catch exceptions thrown in a MEX function.
Execute MATLAB statements to create variables in the caller's workspace.
MEX functions can call MATLAB from user-created threads using the C++ Engine asynchronous API.