Main Content

mxSetPr (Fortran)

(Not recommended) Set real data elements in mxDOUBLE_CLASS array

mxSetPr is not available in the interleaved complex API. Use mxSetDoubles or mxSetComplexDoubles instead. For more information, see Compatibility Considerations.

Fortran Syntax

#include "fintrf.h"
subroutine mxSetPr(pm, pr)
mwPointer pm, pr

Description

The mxSetPr function sets the real data of a real mxDOUBLE_CLASS array pm. If you build with the interleaved complex API (mex -R2018a option) and pm is complex, then the function terminates the MEX file and returns control to the MATLAB® prompt. In a non-MEX file application, the function returns 0.

Call mxIsDouble to validate the mxArray type. Call mxIsComplex to determine whether the data is real.

All mxCreate* functions allocate heap space to hold data. Therefore, you do not ordinarily use this function to initialize the real elements of an array. Instead, call this function to replace the existing values with new values.

The mxSetPr function does not free memory allocated for existing data. To free existing memory, call mxFree on the pointer returned by mxGetPr.

Input Arguments

expand all

Pointer to a MATLAB array of type mxDOUBLE_CLASS, specified as mwPointer.

Pointer to the first mxDouble element of the real part of the data array within an mxArray, specified as mwPointer. 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. If pr points to static memory, then memory leaks and other memory errors can result.

Compatibility Considerations

expand all

Not recommended starting in R2018b

Errors starting in R2018b

Introduced before R2006a