Main Content

Call C/C++ MEX Functions from MATLAB

A MEX file is a function, created in MATLAB®, that calls a C/C++ program

A MEX file is a function, created in MATLAB, that calls a C/C++ program or a Fortran subroutine. A MEX function behaves just like a MATLAB script or function.

To experiment with calling MEX functions, use the code in Tables of MEX Function Source Code Examples to build and run examples.

For information about creating C++ MEX functions, see Write C++ Functions Callable from MATLAB (MEX Files).

For information about using MEX S-functions in models, see your Simulink® documentation.

Categories