Main Content

mxSetImagData (Fortran)

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.

Fortran Syntax

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


The mxSetImagData function is similar to mxSetPi. 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 mwPointer.

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

Version History

Introduced before R2006a

expand all

Not recommended starting in R2018b

Errors starting in R2018b