添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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 call a MEX function, use the name of the MEX file, without the file extension. The MEX file contains only one function or subroutine. The calling syntax depends on the input and output arguments defined by the MEX function. The MEX file must be on your MATLAB path.

While MATLAB scripts and functions have platform-independent extensions .m and .mlx , MEX functions have these 64-bit platform-specific file extensions:

  • Linux ® .mexa64

  • Apple macOS .mexmaci64

  • Microsoft ® Windows ® .mexw64

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 MEX functions, see:

Write C++ Functions Callable from MATLAB (MEX Files) Write C Functions Callable from MATLAB (MEX Files) Write Fortran Functions Callable from MATLAB (MEX Files)

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

Functions

mexext Binary MEX file-name extension

Topics

  • MEX File Placement

    Put your MEX file in a folder on the MATLAB path.

  • Run MEX File You Receive from Someone Else

    How to run a MEX file.

  • Troubleshooting

    MEX Version Compatibility

    For best results, run MEX files built with your MATLAB version.

    MEX Platform Compatibility

    If you get a binary MEX file from another source, be sure that the file was compiled for the same platform on which you want to run it.

    Invalid MEX File Errors

    What to do when you get an invalid MEX file error.

    You clicked a link that corresponds to this MATLAB command:

    Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

    MathWorks

    Accelerating the pace of engineering and science