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.

mxSetImagData (C)

Set imaginary data elements in mxArray

mxSetImagData is not recommended for C applications and is not available in the Interleaved Complex API. Use typed data access functions instead. For more information, see Typed Data Access.

C Syntax

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

Description

mxSetImagData is like mxSetPi, except that in C, its pi argument is a void *. Use this function on numeric arrays with contents other than double.

This function does not free memory allocated for existing data. To free existing memory, call mxFree on the pointer returned by mxGetImagData.

Input Arguments

expand all

Pointer to an mxArray.

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 errors result when the array is destroyed.

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.

See Also

Introduced before R2006a