Main Content

mxSetPi (Fortran)

(Not recommended) Set imaginary data elements in mxDOUBLE_CLASS array

mxSetPi is not available in the interleaved complex API. Use mxSetComplexDoubles instead. For more information, see Compatibility Considerations.

Fortran Syntax

#include "fintrf.h"
subroutine mxSetPi(pm, pi)
mwPointer pm, pi

Description

Use mxSetPi to set the imaginary data of the specified mxArray.

Most mxCreate* functions optionally allocate heap space to hold imaginary data. If you allocate heap space when calling an mxCreate* function, then do not use mxSetPi to initialize the imaginary elements of the array. Rather, call this function to replace existing values with new values. Examples of allocating heap space include setting the ComplexFlag to mxCOMPLEX or setting pi to a non-0 value.

The mxSetPi function does not free any memory allocated for existing data that it displaces. To free existing memory, call mxFree on the pointer returned by mxGetPi.

Input Arguments

expand all

Pointer to a MATLAB array of type mxDOUBLE_CLASS, specified as mwPointer.

Pointer to the first mxDouble element of the imaginary part of the data array within an mxArray, specified as mwPointer. Each element in the array contains the imaginary component of a value.

The array must be in dynamic memory; call mxCalloc to allocate this memory. If pi points to static memory, then memory leaks and other memory errors can result.

Version History

Introduced before R2006a

expand all