This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

mxGetPr (C)

Real data elements in mxDOUBLE_CLASS array

mxGetPr is not recommended for C applications. Use mxGetDoubles instead. For more information, see Typed Data Access.

C Syntax

#include "matrix.h"
double *mxGetPr(const mxArray *pm);


Use mxGetPr on real arrays of type mxDOUBLE_CLASS only. For other numeric mxArray types, use Typed Data Access functions. For complex arrays, see the description for output argument pr.

Call mxIsDouble to validate the mxArray type. Call mxIsComplex to determine that the data is real.

Input Arguments

expand all

Pointer to an mxDOUBLE_CLASS array.

Output Arguments

expand all

The data in the output argument depends on which version of the C Matrix API you use.

  • If you build with the separate complex API (mex -R2017b option), then the function returns a pointer to the first mxDouble element of the real part of the data.

  • If you build with the interleaved complex API (mex -R2018a option) and pm is complex, then the function terminates the MEX file and returns control to the MATLAB® prompt. In a non-MEX file application, the function returns NULL.

If pm is NULL, then the function returns NULL.

API Version

This function is in the separate complex API. To build myMexFile.c using this function, type:

mex -R2017b myMexFile.c

This function is also in the interleaved complex API. However, the function errors for complex input arguments. MathWorks recommends that you upgrade your MEX file to use the Typed Data Access functions instead..

To build myMexFile.c using the interleaved complex API, type:

mex -R2018a myMexFile.c

See Also

Introduced before R2006a