MEX-files (MEX stands for Matlab EXecutable) are dynamically linked subroutines produced from C, C++ or Fortran source code that, when compiled, can be run from within MATLAB® in the same way as MATLAB functions or built-in functions.
In general, MATLAB can be quite efficient in performing a wide variety of numerical tasks. However, from time to time there are certain tasks that require more "low-level" control over the execution. For these kind of tasks MATLAB allows for an easy interface to C/C++/Fortran subroutine pre-compiled and ready to be used as any built-in function.
Here are some useful links for MEX-files: