Main Content

Typed Data Access in C MEX Files

The functions mxGetPr and mxGetPi in the C and Fortran Matrix APIs read data elements in mxArrays of type mxDOUBLE_CLASS. However, these functions do not verify the array type of the input argument. For type-safe data access, use the C mxGetDoubles and mxGetComplexDoubles functions or the Fortran mxGetDoubles and mxGetComplexDoubles functions. There are typed data access functions for each numeric mxArray type, as shown in this table.

The typed data access functions are part of the interleaved complex C and Fortran Matrix APIs; use the mex -R2018a option to build the MEX functions.

Related Topics