This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Binary MEX file-name extension


ext = mexext
extlist = mexext('all')



ext = mexext returns the file-name extension for the current platform.


extlist = mexext('all') returns the extensions for all platforms.


collapse all

Find the MEX file extension for the system you are currently working on.

ext = mexext
ext = 

Your results reflect your system.

Get the list of file extensions for supported platforms.

extlist = mexext('all');

The mex command identifies a platform by its arch value, which is the output of the computer('arch') command. For Mac platforms, the value is maci64.

Search the arch field in extlist for 'maci64', and display the corresponding ext field.

for k=1:length(extlist)
   if strcmp(extlist(k).arch, 'maci64')
   disp(sprintf('Arch: %s  File Extension: %s', extlist(k).arch, extlist(k).ext))
Arch: maci64  File Extension: mexmaci64

Output Arguments

collapse all

File-name extension for MEX file, returned as one of these values.

MEX File Platform-Dependent Extension

PlatformBinary MEX File Extension

Linux® (64-bit)


Apple Mac (64-bit)


Windows® (64-bit)


All file-name extensions, returned as a structure with these fields:

Platform, returned as a character vector. The name of the platform is the output of the computer('arch') command.

File extension, returned as a character vector.


  • To use the MEX file-name extension in makefiles or scripts outside MATLAB®, type one of the following from the system command prompt. The script is located in the matlabroot\bin folder.

    • mexext.bat—Windows platform.

    •—UNIX® platform.

      For example, the following commands are in a GNU® makefile.

      ext = $(shell mexext)
      yprime.$(ext) : yprime.c 
      		mex yprime.c

See Also


Introduced before R2006a