Main Content

mxSetImagData (C)

Set imaginary data elements in numeric mxArray

mxSetImagData is not available in the interleaved complex API. Use typed, data-access functions instead. For more information, see Compatibility Considerations.

C Syntax

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

Description

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

The mxSetImagData 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 a MATLAB array, specified as mxArray *.

Pointer to the complex data array within an mxArray, specified as void *. 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.

Version History

Introduced before R2006a

expand all