mxGetData (C and Fortran) - Get pointer to data

C Syntax

#include "matrix.h"
void *mxGetData(const mxArray *pm);

Fortran Syntax

mwPointer mxGetData(pm)
mwPointer pm

Arguments

pm

Pointer to an mxArray

Returns

The address of the first element of the real data. Returns NULL in C (0 in Fortran) if there is no real data.

Description

Similar to mxGetPr, except that in C, mxGetData returns a void *.

To copy values from the returned pointer to Fortran, use one of the mxCopyPtrTo* functions in the following manner:

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

C Examples

See phonebook.c in the refbook subdirectory of the examples directory.

For additional examples, see mxcreatecharmatrixfromstr.c and mxisfinite.c in the mx subdirectory of the examples directory.

See Also

mxGetImagData, mxGetPr

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS