This is machine translation

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

mxGetPi (C and Fortran)

Imaginary data elements in array of type DOUBLE

C Syntax

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

Fortran Syntax

mwPointer mxGetPi(pm)
mwPointer pm



Pointer to an mxArray of type double


Pointer to the imaginary data elements of the specified mxArray, on success. Returns NULL in C (0 in Fortran) if there is no imaginary data or if there is an error.


Use mxGetPi on arrays of type double only. Use mxIsDouble to validate the mxArray type. For other mxArray types, use mxGetImagData.

The pi field points to an array containing the imaginary data of the mxArray. Call mxGetPi to get the contents of the pi field, that is, to get the starting address of this imaginary data.

The best way to determine whether an mxArray is purely real is to call mxIsComplex.

If any of the input matrices to a function are complex, MATLAB® allocates the imaginary parts of all input matrices.


See the following examples in matlabroot/extern/examples/refbook.

For Fortran examples, see:

See the following examples in matlabroot/extern/examples/mx.

See the following examples in matlabroot/extern/examples/mex.

Introduced before R2006a

Was this topic helpful?