This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

mxSetPi (C)

Set imaginary data elements in mxDOUBLE_CLASS array

mxSetPi is not recommended for C applications and is not available in the Interleaved Complex API. Use mxSetComplexDoubles instead of mxSetPr and mxSetPi. For more information, see Typed Data Access.

C Syntax

#include "matrix.h"
void mxSetPi(mxArray *pm, double *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—for example, by setting the ComplexFlag to mxCOMPLEX or by setting pi to a non-NULL value—you do not ordinarily use mxSetPi to initialize the imaginary elements of the array. Rather, you call this function to replace existing values with new values.

This 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 an mxDOUBLE_CLASS array.

Pointer to the first element of an array. 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. Do not use the ANSI® C calloc function, which can cause memory alignment issues leading to program termination. If pi points to static memory, then memory leaks and other memory errors can result.

API Version

This function is only available in the separate complex API. To build myMexFile.c using this function, type:

mex -R2017b myMexFile.c

MathWorks recommends that you upgrade your MEX file to use the Typed Data Access functions instead.

Introduced before R2006a