Main Content

mxDestroyArray (Fortran)

Free dynamic memory allocated by MXCREATE* functions

Fortran Syntax

#include "fintrf.h"
subroutine mxDestroyArray(pm)
mwPointer pm


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 mwPointer. If pm is 0, then the function does nothing.


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

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

Version History

Introduced before R2006a