mxGetPi, mxGetPr, mxSetPi, mxSetPr

Purpose

Get and set pointers to the real and imaginary parts of a Matrix.

C Synopsis

double *mxGetPi(pm)
  Matrix *pm;
double *mxGetPr(pm)
  Matrix *pm;
void mxSetPi(pm,pi)
  Matrix *pm;
  double *pr;
void mxSetPr(pm,pr)
  Matrix *pm;
  double *pr;

Fortran Synopsis

integer*4 function mxGetPr(pm)
integer*4 function mxGetPi(pm)
subroutine mxSetPr(pm,pr)
subroutine mxSetPi(pm,pi)
integer*4 pm,pr,pi

Arguments

pi
pointer to the imaginary part of Matrix
pm
pointer to the Matrix structure
pr
pointer to the real part of Matrix

Description

These routines let you get and set the pointers to the real and imaginary parts of a Matrix. If the pointer returned by mxGetPi is 0 (NULL), the Matrix is purely real. You can also use mxIsComplex to test if a Matrix is complex.

The imaginary parts of all input Matrices to a MATLAB function are allocated if any of the input Matrices are complex.

If you use mxGetPr or mxGetPi, note that mxFreeMatrix frees pr and pi using mxFree, so pr and pi should be set only to memory allocated with mxCalloc; they should not be set to statically allocated memory.

(c) Copyright 1994 by The MathWorks, Inc.