Documentation Center (Beta)

Creating C/C++ and Fortran Programs to be Callable from MATLAB (MEX-Files)

Build C/C++ and Fortran subroutines into callable MEX files

Functions

dbmex Enable MEX-file debugging (on UNIX platforms)
inmem Names of functions, MEX-files, Sun Java classes in memory
mex Compile MEX-function from C/C++ or Fortran source code
mex.getCompilerConfigurations Get compiler configuration information for building MEX-files
mexext Binary MEX-file name extension
mexAtExit (C and Fortran) Register function to call when MEX-function cleared or MATLAB software terminates
mexCallMATLAB (C and Fortran) Call MATLAB function, user-defined function, or MEX-file
mexCallMATLABWithTrap (C and Fortran) Call MATLAB function, user-defined function, or MEX-file and capture error information
mexErrMsgIdAndTxt (C and Fortran) Display error message with identifier and return to MATLAB prompt
mexErrMsgTxt (C and Fortran) Display error message and return to MATLAB prompt
mexEvalString (C and Fortran) Execute MATLAB command in caller workspace
mexEvalStringWithTrap (C and Fortran) Execute MATLAB command in caller workspace and capture error information
mexFunction (C and Fortran) Entry point to C/C++ or Fortran MEX-file
mexFunctionName (C and Fortran) Name of current MEX-function
mexGet (C) Value of specified Handle Graphics property
mexGetVariable (C and Fortran) Copy of variable from specified workspace
mexGetVariablePtr (C and Fortran) Read-only pointer to variable from another workspace
mexIsGlobal (C and Fortran) Determine whether variable has global scope
mexIsLocked (C and Fortran) Determine whether MEX-file is locked
mexLock (C and Fortran) Prevent clearing MEX-file from memory
mexMakeArrayPersistent (C and Fortran) Make array persist after MEX-file completes
mexMakeMemoryPersistent (C and Fortran) Make memory allocated by MATLAB software persist after MEX-function completes
mexPrintf (C and Fortran) ANSI C PRINTF-style output routine
mexPutVariable (C and Fortran) Array from MEX-function into specified workspace
mexSet (C) Set value of specified Handle Graphics property
mexSetTrapFlag (C and Fortran) Control response of MEXCALLMATLAB to errors
mexUnlock (C and Fortran) Allow clearing MEX-file from memory
mexWarnMsgIdAndTxt (C and Fortran) Warning message with identifier
mexWarnMsgTxt (C and Fortran) Warning message

Troubleshooting

We want your feedback!

Fill out a short survey to help us improve the Documentation Center.