Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

C MEX Library API

Use this library to perform operations in the MATLAB® environment from C/C++ MEX files

Use mexFunction in a MEX file like you would main in C or C++ programs. To call a MATLAB function, use mexCallMATLAB or mexEvalString. To pass data between the MEX file and the MATLAB workspace, use the mexGet* and mexSet* functions.

mexFunctionEntry point to C/C++ or Fortran MEX file
mexFunctionNameName of current MEX function
mexAtExitRegister function to call when MEX function clears or MATLAB terminates
mexCallMATLABCall MATLAB function, user-defined function, or MEX file
mexCallMATLABWithTrapCall MATLAB function, user-defined function, or MEX-file and capture error information
mexEvalStringExecute MATLAB command in caller workspace
mexEvalStringWithTrapExecute MATLAB command in caller workspace and capture error information
mexGetValue of specified graphics property
mexSetSet value of specified graphics property
mexGetVariableCopy of variable from specified workspace
mexGetVariablePtrRead-only pointer to variable from another workspace
mexPutVariableArray from MEX-function into specified workspace
mexPrintfANSI C PRINTF-style output routine
mexSetTrapFlagControl response of MEXCALLMATLAB to errors
mexErrMsgIdAndTxtDisplay error message with identifier and return to MATLAB prompt
mexWarnMsgIdAndTxtWarning message with identifier
mexErrMsgTxtDisplay error message and return to MATLAB prompt
mexWarnMsgTxtWarning message
mexIsLockedDetermine if MEX-file is locked
mexLockPrevent clearing MEX-file from memory
mexUnlockAllow clearing MEX-file from memory
mexMakeArrayPersistentMake array persist after MEX file completes
mexMakeMemoryPersistentMake memory allocated by MATLAB software persist after MEX-function completes
Was this topic helpful?