Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

MEX File Creation API

Build MATLAB® functions from C/C++ and Fortran functions

Call your own C, C++, or Fortran 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.

Write your programs using the MATLAB API libraries — MEX Library and the C/C++ Matrix Library or Fortran Matrix Library. The functions in these libraries facilitate the transfer of data between MEX files and the workspace. Build the source file into an executable program using the mex function. You can also share the MEX file with other MATLAB users.

If you want to call MATLAB functions from C, C++, or Fortran programs, use the MATLAB Engine API for C, C++, and Fortran library functions.

Was this topic helpful?