| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
#include "matrix.h" void mxSetPr(mxArray *pm, double *pr);
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 dynamic memory. 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 mxsetnzmax.c in the matlabroot/extern/examples/mx folder .
mxGetPi, mxGetPr, mxSetData, mxSetPi, mxFree
![]() | mxSetPi (C and Fortran) | mxSetProperty (C and Fortran) | ![]() |

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 |