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.

mxSetData (Fortran)

Set pointer to data elements in nonnumeric mxArray

Use mxSetData for nonnumeric arrays only. mxSetData is not recommended for numeric arrays in Fortran applications. Use typed data access functions instead. For more information, see Typed Data Access.

Fortran Syntax

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

Description

Use mxSetData to set data elements for nonnumeric arrays only.

This 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 mxArray.

Void pointer to an array of data.

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

API Version

Use this function for nonnumeric input arguments only. Otherwise, MathWorks recommends that you upgrade your MEX file to use the Typed Data Access functions instead.

This function is in the separate complex API. To build myMexFile.F using this function, type:

mex -R2017b myMexFile.F

This function is also in the interleaved complex API. However, the results are different for complex input argument pm.

  • If pm is a real array, then pa becomes the real component of pm.

  • If pm is complex array, then pa must also be complex. Otherwise, the elements of pa become interleaved real and imaginary values, not real-only values.

To build myMexFile.F using the interleaved complex API, type:

mex -R2018a myMexFile.F

Introduced before R2006a