MATLAB Application Program Interface
  Go to function:
    Search    Help Desk 
mxSetPr    Examples   See Also

Set new real data for an mxArray

C Syntax

Arguments

array_ptr
  Pointer to a full (nonsparse) mxArray.

pr
  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 dynamic memory. If pr points to static memory, then memory leaks and other memory errors may result.

Description

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 typically call mxSetPr to replace the initial real values with new ones.

Examples

Create a populated 2-by-3 real-only mxArray. Then, change its data.

Apricot initially contains

After calling mxSetPr, Apricot contains

For an additional example, see mxsetpr.c in the mx subdirectory of the examples directory.

See Also

mxGetPr, mxGetPi, mxSetPi



[ Previous | Help Desk | Next ]