Main Content

mxDestroyArray (C)

Free dynamic memory allocated by MXCREATE* functions

C Syntax

#include "matrix.h"
void mxDestroyArray(mxArray *pm);

Description

mxDestroyArray deallocates memory for the specified mxArray including:

  • Characteristics fields of the mxArray, such as size (m and n) and type

  • Associated data arrays, such as ir and jc for sparse arrays

  • Fields of structure arrays

  • Cells of cell arrays

Do not call mxDestroyArray on an mxArray:

  • Returned in a left-side argument of a MEX file

  • Returned by the mxGetField or mxGetFieldByNumber functions

  • Returned by the mxGetCell function

Input Arguments

expand all

Pointer to the mxArray to free, specified as mxArray *. If pm is a NULL pointer, then the function does nothing.

Examples

See these examples in matlabroot/extern/examples/refbook:

See these examples in matlabroot/extern/examples/mex:

See these examples in matlabroot/extern/examples/mx:

Introduced before R2006a