Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

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

Pointer to 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 matlabroot/extern/examples/refbook folder .

For additional examples, see mxcreatecharmatrixfromstr.c and mxisfinite.c in the matlabroot/extern/examples/mx folder .

See Also

mxGetImagData, mxGetPr

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

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