This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

mxDestroyArray (C and Fortran)

Free dynamic memory allocated by MXCREATE* functions

C Syntax

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

Fortran Syntax

subroutine mxDestroyArray(pm)
mwPointer pm



Pointer to the mxArray to free


mxDestroyArray deallocates the memory occupied by the specified mxArray including:

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

  • Associated data arrays, such as pr and pi for complex arrays, and 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.


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

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

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

Introduced before R2006a

Was this topic helpful?