mxArray
that work with MATLAB®
Functions in the C MEX APIs work with the MATLAB
mxArray
data type, which is defined in the C Matrix API. To write applications using C++11 features, see C++ MEX Applications.
You can call your own C or C++ programs from the MATLAB command line as if they were built-in functions. These programs are called MEX files and the function name is the MEX file name.
To create a MEX file, write your programs using MATLAB APIs. The functions in these libraries facilitate the transfer of data between MEX files and the workspace. Choose either the C Matrix API or the MATLAB Data API; you cannot mix functions from these APIs.
C Matrix API
and the C MEX API. These APIs use the MATLAB
mxArray
data type.
MATLAB Data API. This
API defines the matlab::data::Array
class and uses
features from C++11. For more information, see C++ MEX Applications.
Build your source file into an executable program using the mex
function. You can also share
the MEX file with other MATLAB users.
If you have a C/C++ program and want to call MATLAB functions from the program, then use one of the engine APIs.
If you want to read and write MATLAB data from C/C++ programs, then use the MATLAB C API to Read MAT-File Data.
mxArray
mxArray
API libraries