Documentation Center

  • Trial Software
  • Product Updates

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

Arguments

pm

Pointer to an mxArray of type double

Returns

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.

Description

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.

Examples

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.

Was this topic helpful?