Main Content

mxSetPi (C)

(Not recommended) Set imaginary data elements inmxDOUBLE_CLASSarray

mxSetPiis not available in the interleaved complex API. UsemxSetComplexDoublesinstead. For more information, seeCompatibility Considerations.

C Syntax

#include "matrix.h" void mxSetPi(mxArray *pm, double *pi);

Description

UsemxSetPito set the imaginary data of the specifiedmxArray.

MostmxCreate* functions optionally allocate heap space to hold imaginary data. If you allocate heap space when calling anmxCreate* function, then do not usemxSetPito initialize the imaginary elements of the array. Instead, call this function to replace existing values with new values. Examples of allocating heap space include setting theComplexFlagtomxCOMPLEXor settingpito a non-NULLvalue.

ThemxSetPifunction does not free any memory allocated for existing data that it displaces. To free existing memory, callmxFreeon the pointer returned bymxGetPi.

Input Arguments

expand all

Pointer to a MATLAB array of typemxDOUBLE_CLASS, specified asmxArray *.

Pointer to the firstmxDoubleelement of the imaginary part of the data array within anmxArray, specified asdouble *. Each element in the array contains the imaginary component of a value.

The array must be in dynamic memory. CallmxCallocto allocate this memory. Do not use theANSI®Ccallocfunction, which can cause memory alignment issues leading to program termination.Ifpipoints to static memory, then memory leaks and other memory errors can result.

版本历史

Introduced before R2006a

expand all

Not recommended starting in R2018a

Errors starting in R2018a