matlab mxgetdata函数语法

发表matlab mxgetdata函数相关文章
一句话说明: Pointer to real numeric data elements in array

mxGetData (C and Fortran)

Pointer to real numeric data elements in array

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

In C, mxGetData returns a void pointer (void *). Since void pointers point to a value that has no type, you must cast the return value to the pointer type that matches the type specified by pm. To see how MATLAB® types map to their equivalent C types, see the table on the mxClassID reference page.

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

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

Examples

See the following examples in matlabroot/extern/examples/mex.

See the following examples in matlabroot/extern/examples/refbook.

See the following examples in matlabroot/extern/examples/mx.

See Also

mxGetImagData, mxGetPr, mxClassID

欢迎转载,转载请注明来自一手册:http://yishouce.com/matlab/func/mxgetdata

与matlab mxgetdata用法相关的文章

友情链接It题库(ittiku.com)| 版权归yishouce.com所有| 友链等可联系 admin#yishouce.com|粤ICP备16001685号-1