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

Use mxGetData for nonnumeric arrays only. mxGetData 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"
mwPointer mxGetData(pm)
mwPointer pm

Description

Use mxGetData to get data elements for nonnumeric arrays only.

Input Arguments

expand all

Pointer to a nonnumeric mxArray.

Output Arguments

expand all

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.

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 function returns a different value for a complex numeric input argument.

  • If pm is a real array, then the function returns a pointer to the first element of the real part of the data.

  • If pm is a complex array, then the function returns a pointer to the first element of the interleaved real and imaginary values, not to the real-only values.

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

mex -R2018a myMexFile.F

Introduced before R2006a