Main Content

mxSetData (Fortran)

Set pointer to data elements in nonnumeric mxArray

mxSetData is not recommended for numeric arrays. Use typed, data-access functions instead. For more information, see Compatibility Considerations.

Fortran Syntax

#include "fintrf.h"
subroutine mxSetData(pm, pr)
mwPointer pm, pr

Description

Use mxSetData to set data elements for nonnumeric arrays only.

For numeric arrays, MathWorks recommends that you create MEX files and update existing MEX files to use the typed, data-access functions in the interleaved complex API. For more information, see:

To build the MEX file, call mex with the -R2018a option.

The mxSetData function does not free memory allocated for existing data. To free existing memory, call mxFree on the pointer returned by mxGetData.

Input Arguments

expand all

Pointer to a nonnumeric MATLAB array, specified as mwPointer.

Pointer to the data array within an mxArray, specified as mwPointer.

The array must be in dynamic memory. Call mxCalloc to allocate this memory.

Compatibility Considerations

expand all

Behavior changed in R2018b

Introduced before R2006a