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.

mxGetData (Fortran)

Data elements in nonnumeric mxArray

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

Fortran Syntax

#include "fintrf.h"
mwPointer mxGetData(pm)
mwPointer pm

Description

Use mxGetData to get 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.

Input Arguments

expand all

Pointer to a nonnumeric MATLAB array, specified as mwPointer.

Output Arguments

expand all

Pointer to the data array within an mxArray, specified as mwPointer. Since void pointers point to a value that has no type, cast the return value to the pointer type that matches the type specified by pm.

To copy values from the returned pointer, use one of the mxCopyPtrTo* functions. For example:

C      Get the data in mxArray, pm
       mxCopyPtrToReal8(mxGetData(pm),data,
     +                  mxGetNumberOfElements(pm))

If pm is 0, then the function returns 0.

Compatibility Considerations

expand all

Behavior changed in R2018b

Introduced before R2006a