This is machine translation

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

Using MEX Files

Binary MEX files are subroutines produced from C/C++ or Fortran source code. They behave just like MATLAB® scripts and built-in functions. To call a MEX file, use the name of the file, without the file extension. The calling syntax depends on the input and output arguments defined by the MEX file.

While scripts have a platform-independent extension .m, MATLAB identifies MEX files by platform-specific extensions. The following table lists the platform-specific extensions for MEX files.

MEX File Platform-Dependent Extension

PlatformBinary MEX File Extension

Linux® (64-bit)


Apple Mac (64-bit)


Windows® (64-bit)


You cannot use a binary MEX file on a platform if you compiled it on a different platform. Recompile the source code on the platform for which you want to use the MEX file. For information about using MEX S-functions, see your Simulink® documentation.

Was this topic helpful?