Set imaginary data elements in
#include "matrix.h" void mxSetImagData(mxArray *pm, void *pi);
mxSetImagData is like
mxSetPi, except that
in C, its
pi argument is a
void *. Use this
function on numeric arrays with contents other than
This function does not free memory allocated for existing data. To free existing
mxFree on the pointer returned by
pm— MATLAB array
Pointer to an
pi— Data 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
allocate this memory. Do not use the ANSI®
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.
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.