C and Fortran API Reference


MAT-File AccessIncorporate and use MATLAB® data in C and Fortran programs
MX Array ManipulationCreate and manipulate MATLAB® arrays from C and Fortran MEX and engine routines
MEX-FilesPerform operations in MATLAB® environment from C and Fortran MEX-files
MATLAB® EngineCall MATLAB® software from C and Fortran programs


See also External Interfaces in the MATLAB® Function Reference for interfaces to DLLs, Sun™ Java™ programming language, Microsoft® Component Object Model (COM) and Microsoft® ActiveX® technologies, Web services, and serial port devices.

MAT-File Access

matClose (C and Fortran)Close MAT-file
matDeleteVariable (C and Fortran)Delete named mxArray from MAT-file
MATFile (C and Fortran)Type for a MAT-file
matGetDir (C and Fortran)Get directory of mxArrays in MAT-file
matGetFp (C)Get file pointer to MAT-file
matGetNextVariable (C and Fortran)Read next mxArray from MAT-file
matGetNextVariableInfo (C and Fortran)Load array header information only
matGetVariable (C and Fortran)Read mxArray from MAT-files
matGetVariableInfo (C and Fortran)Load array header information only
matOpen (C and Fortran)Open MAT-file
matPutVariable (C and Fortran)Write mxArrays to MAT-files
matPutVariableAsGlobal (C and Fortran)Put mxArrays into MAT-files as originating from global workspace

MX Array Manipulation

mwIndex (C and Fortran)Type for index values
mwPointer (Fortran)Declare appropriate pointer type for platform
mwSize (C and Fortran)Type for size values
mxAddField (C and Fortran)Add field to structure array
mxArray (C and Fortran)Type for a MATLAB® array
mxArrayToString (C)Convert array to string
mxAssert (C)Check assertion value for debugging purposes
mxAssertS (C)Check assertion value without printing assertion text
mxCalcSingleSubscript (C and Fortran)Offset from first element to desired element
mxCalloc (C and Fortran)Allocate dynamic memory for array using MATLAB® memory manager
mxChar (C)Type for string mxArray
mxClassID (C)Enumerated value identifying class of mxArray
mxClassIDFromClassName (Fortran)Identifier corresponding to class
mxComplexity (C)Flag specifying whether mxArray has imaginary components
mxCopyCharacterToPtr (Fortran)Copy character values from Fortran array to pointer array
mxCopyComplex16ToPtr (Fortran)Copy COMPLEX*16 values from Fortran array to pointer array
mxCopyComplex8ToPtr (Fortran)Copy COMPLEX*8 values from Fortran array to pointer array
mxCopyInteger1ToPtr (Fortran)Copy INTEGER*1 values from Fortran array to pointer array
mxCopyInteger2ToPtr (Fortran)Copy INTEGER*2 values from Fortran array to pointer array
mxCopyInteger4ToPtr (Fortran)Copy INTEGER*4 values from Fortran array to pointer array
mxCopyPtrToCharacter (Fortran)Copy character values from pointer array to Fortran array
mxCopyPtrToComplex16 (Fortran)Copy COMPLEX*16 values from pointer array to Fortran array
mxCopyPtrToComplex8 (Fortran)Copy COMPLEX*8 values from pointer array to Fortran array
mxCopyPtrToInteger1 (Fortran)Copy INTEGER*1 values from pointer array to Fortran array
mxCopyPtrToInteger2 (Fortran)Copy INTEGER*2 values from pointer array to Fortran array
mxCopyPtrToInteger4 (Fortran)Copy INTEGER*4 values from pointer array to Fortran array
mxCopyPtrToPtrArray (Fortran)Copy pointer values from pointer array to Fortran array
mxCopyPtrToReal4 (Fortran)Copy REAL*4 values from pointer array to Fortran array
mxCopyPtrToReal8 (Fortran)Copy REAL*8 values from pointer array to Fortran array
mxCopyReal4ToPtr (Fortran)Copy REAL*4 values from Fortran array to pointer array
mxCopyReal8ToPtr (Fortran)Copy REAL*8 values from Fortran array to pointer array
mxCreateCellArray (C and Fortran)Create unpopulated N-D cell mxArray
mxCreateCellMatrix (C and Fortran)Create unpopulated 2-D cell mxArray
mxCreateCharArray (C and Fortran)Create unpopulated N-D string mxArray
mxCreateCharMatrixFromStrings (C and Fortran)Create populated 2-D string mxArray
mxCreateDoubleMatrix (C and Fortran)Create 2-D, double-precision, floating-point mxArray initialized to 0
mxCreateDoubleScalar (C and Fortran)Create scalar, double-precision array initialized to specified value
mxCreateLogicalArray (C)Create N-D logical mxArray initialized to false
mxCreateLogicalMatrix (C)Create 2-D, logical mxArray initialized to false
mxCreateLogicalScalar (C)Create scalar, logical mxArray initialized to false
mxCreateNumericArray (C and Fortran)Create unpopulated N-D numeric mxArray
mxCreateNumericMatrix (C and Fortran)Create numeric matrix and initialize data elements to 0
mxCreateSparse (C and Fortran)Create 2-D unpopulated sparse mxArray
mxCreateSparseLogicalMatrix (C)Create unpopulated 2-D, sparse, logical mxArray
mxCreateString (C and Fortran)Create 1-by-N string mxArray initialized to specified string
mxCreateStructArray (C and Fortran)Create unpopulated N-D structure mxArray
mxCreateStructMatrix (C and Fortran)Create unpopulated 2-D structure mxArray
mxDestroyArray (C and Fortran)Free dynamic memory allocated by mxCreate* functions
mxDuplicateArray (C and Fortran)Make deep copy of array
mxFree (C and Fortran)Free dynamic memory allocated by mxCalloc, mxMalloc, or mxRealloc
mxGetCell (C and Fortran)Get contents of mxArray cell
mxGetChars (C)Get pointer to character array data
mxGetClassID (C and Fortran)Get class of mxArray
mxGetClassName (C and Fortran)Get class of mxArray as string
mxGetData (C and Fortran)Get pointer to data
mxGetDimensions (C and Fortran)Get pointer to dimensions array
mxGetElementSize (C and Fortran)Get number of bytes required to store each data element
mxGetEps (C and Fortran)Get value of eps
mxGetField (C and Fortran)Get field value, given field name and index into structure array
mxGetFieldByNumber (C and Fortran)Get field value, given field number and index into structure array
mxGetFieldNameByNumber (C and Fortran)Get field name, given field number in structure array
mxGetFieldNumber (C and Fortran)Get field number, given field name in structure array
mxGetImagData (C and Fortran)Get pointer to imaginary data of mxArray
mxGetInf (C and Fortran)Get value of infinity
mxGetIr (C and Fortran)Get ir array of sparse matrix
mxGetJc (C and Fortran)Get jc array of sparse matrix
mxGetLogicals (C)Get pointer to logical array data
mxGetM (C and Fortran)Get number of rows in mxArray
mxGetN (C and Fortran)Get number of columns in mxArray
mxGetNaN (C and Fortran)Get value of NaN (Not-a-Number)
mxGetNumberOfDimensions (C and Fortran)Get number of dimensions in mxArray
mxGetNumberOfElements (C and Fortran)Get number of elements in mxArray
mxGetNumberOfFields (C and Fortran)Get number of fields in structure mxArray
mxGetNzmax (C and Fortran)Get number of elements in ir, pr, and pi arrays
mxGetPi (C and Fortran)Get imaginary data elements in mxArray
mxGetPr (C and Fortran)Get real data elements in mxArray
mxGetProperty (C and Fortran)Get property value of MATLAB® class object
mxGetScalar (C and Fortran)Get real component of first data element in mxArray
mxGetString (C and Fortran)Copy string mxArray to C-style string
mxIsCell (C and Fortran)Determine whether input is cell mxArray
mxIsChar (C and Fortran)Determine whether input is string mxArray
mxIsClass (C and Fortran)Determine whether mxArray is member of specified class
mxIsComplex (C and Fortran)Determine whether data is complex
mxIsDouble (C and Fortran)Determine whether mxArray represents data as double-precision, floating-point numbers
mxIsEmpty (C and Fortran)Determine whether mxArray is empty
mxIsFinite (C and Fortran)Determine whether input is finite
mxIsFromGlobalWS (C and Fortran)Determine whether mxArray was copied from MATLAB® global workspace
mxIsInf (C and Fortran)Determine whether input is infinite
mxIsInt16 (C and Fortran)Determine whether mxArray represents data as signed 16-bit integers
mxIsInt32 (C and Fortran)Determine whether mxArray represents data as signed 32-bit integers
mxIsInt64 (C and Fortran)Determine whether mxArray represents data as signed 64-bit integers
mxIsInt8 (C and Fortran)Determine whether mxArray represents data as signed 8-bit integers
mxIsLogical (C and Fortran)Determine whether mxArray is of type mxLogical
mxIsLogicalScalar (C)Determine whether scalar mxArray is of type mxLogical
mxIsLogicalScalarTrue (C)Determine whether scalar mxArray of type mxLogical is true
mxIsNaN (C and Fortran)Determine whether input is NaN (Not-a-Number)
mxIsNumeric (C and Fortran)Determine whether mxArray is numeric
mxIsSingle (C and Fortran)Determine whether mxArray represents data as single-precision, floating-point numbers
mxIsSparse (C and Fortran)Determine whether input is sparse mxArray
mxIsStruct (C and Fortran)Determine whether input is structure mxArray
mxIsUint16 (C and Fortran)Determine whether mxArray represents data as unsigned 16-bit integers
mxIsUint32 (C and Fortran)Determine whether mxArray represents data as unsigned 32-bit integers
mxIsUint64 (C and Fortran)Determine whether mxArray represents data as unsigned 64-bit integers
mxIsUint8 (C and Fortran)Determine whether mxArray represents data as unsigned 8-bit integers
mxLogical (C)Type for logical mxArray
mxMalloc (C and Fortran)Allocate dynamic memory using MATLAB® memory manager
mxRealloc (C and Fortran)Reallocate memory
mxRemoveField (C and Fortran)Remove field from structure array
mxSetCell (C and Fortran)Set value of one cell of mxArray
mxSetClassName (C)Convert structure array to MATLAB® object array
mxSetData (C and Fortran)Set pointer to data
mxSetDimensions (C and Fortran)Modify number of dimensions and size of each dimension
mxSetField (C and Fortran)Set structure array field, given field name and index
mxSetFieldByNumber (C and Fortran)Set structure array field, given field number and index
mxSetImagData (C and Fortran)Set imaginary data pointer for mxArray
mxSetIr (C and Fortran)Set ir array of sparse mxArray
mxSetJc (C and Fortran)Set jc array of sparse mxArray
mxSetM (C and Fortran)Set number of rows in mxArray
mxSetN (C and Fortran)Set number of columns in mxArray
mxSetNzmax (C and Fortran)Set storage space for nonzero elements
mxSetPi (C and Fortran)Set new imaginary data for mxArray
mxSetPr (C and Fortran)Set new real data for mxArray
mxSetProperty (C and Fortran)Set value of property of MATLAB® class object

MEX-Files

mexAtExit (C and Fortran)Register function to call when MEX-function is cleared or MATLAB® software terminates
mexCallMATLAB (C and Fortran)Call MATLAB® function or user-defined M-file or MEX-file
mexErrMsgIdAndTxt (C and Fortran)Issue error message with identifier and return to MATLAB® prompt
mexErrMsgTxt (C and Fortran)Issue error message and return to MATLAB® prompt
mexEvalString (C and Fortran)Execute MATLAB® command in caller's workspace
mexFunction (C and Fortran)Entry point to C MEX-file
mexFunctionName (C and Fortran)Name of current MEX-function
mexGet (C)Get value of specified Handle Graphics® property
mexGetVariable (C and Fortran)Get copy of variable from specified workspace
mexGetVariablePtr (C and Fortran)Get read-only pointer to variable from another workspace
mexIsGlobal (C and Fortran)Determine whether mxArray has global scope
mexIsLocked (C and Fortran)Determine whether MEX-file is locked
mexLock (C and Fortran)Prevent MEX-file from being cleared from memory
mexMakeArrayPersistent (C and Fortran)Make mxArray 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)Copy mxArray 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 MEX-file to be cleared from memory
mexWarnMsgIdAndTxt (C and Fortran)Issue warning message with identifier
mexWarnMsgTxt (C and Fortran)Issue warning message

MATLAB® Engine

engClose (C and Fortran)Quit MATLAB® engine session
engEvalString (C and Fortran)Evaluate expression in string
engGetVariable (C and Fortran)Copy variable from MATLAB® engine workspace
engGetVisible (C)Determine visibility of MATLAB® engine session
Engine (C)Type for a MATLAB® engine
engOpen (C and Fortran)Start MATLAB® engine session
engOpenSingleUse (C)Start MATLAB® engine session for single, nonshared use
engOutputBuffer (C and Fortran)Specify buffer for MATLAB® output
engPutVariable (C and Fortran)Put variables into MATLAB® engine workspace
engSetVisible (C)Show or hide MATLAB® engine session
  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS