matlab mxsetpr函数语法

发表matlab mxsetpr函数相关文章
一句话说明: Set new real data elements in array of type DOUBLE

mxSetPr (C and Fortran)

Set new real data elements in array of type DOUBLE

C Syntax

#include "matrix.h"
void mxSetPr(mxArray *pm, double *pr);

Fortran Syntax

subroutine mxSetPr(pm, pr)
mwPointer pm, pr



Pointer to a full (nonsparse) mxArray


Pointer to the first element of an array. Each element in the array contains the real component of a value. The array must be in dynamic memory; call mxCalloc to allocate this memory. Do not use the ANSI® C calloc function, which can cause memory alignment issues leading to program termination. If pr points to static memory, memory leaks and other memory errors can result.


Use mxSetPr to set the real data of the specified mxArray.

All mxCreate* calls allocate heap space to hold real data. Therefore, you do not ordinarily use mxSetPr to initialize the real elements of a freshly created mxArray. Rather, you call mxSetPr to replace the initial real values with new ones.

This function does not free any memory allocated for existing data that it displaces. To free existing memory, call mxFree on the pointer returned by mxGetPr before you call mxSetPr.


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

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

See Also

mxGetPi, mxGetPr, mxSetData, mxSetPi, mxFree


与matlab mxsetpr用法相关的文章

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