mxGetPr (C and Fortran)

Real data elements in array of type DOUBLE

C Syntax

#include "matrix.h"
double *mxGetPr(const mxArray *pm);

Fortran Syntax

mwPointer mxGetPr(pm)
mwPointer pm

Arguments

pm

Pointer to an mxArray of type double

Returns

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

Description

Use mxGetPr on arrays of type double only. Use mxIsDouble to validate the mxArray type. For other mxArray types, use mxGetData.

Call mxGetPr to access the real data in the mxArray that pm points to. Once you have the starting address, you can access any other element in the mxArray.

Was this topic helpful?