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.

Introducing MEX Files

You can call your own C, C++, or Fortran subroutines from the MATLAB® command line as if they were built-in functions. These programs, called binary MEX files, are dynamically linked subroutines that the MATLAB interpreter loads and executes. The MEX file contains only one function or subroutine, and its name is the MEX file name. To call a MEX file, use the name of the file, without the file extension.

For information about using a MEX file that someone else created, see Call MEX File Functions.

The term mex stands for “MATLAB executable” and has different meanings, as shown in the following table.

MEX TermDefinition
source MEX fileC, C++, or Fortran source code file.
binary MEX fileDynamically linked subroutine executed in the MATLAB environment.
MEX function libraryMATLAB C and Fortran API Reference library to perform operations in the MATLAB environment.
mex build scriptMATLAB function to create a binary file from a source file.

Related Examples

More About

Was this topic helpful?