Using the C Math Library | ![]() ![]() |
Deleting Bound Arrays
mlfAssign()
mxDestroyArray()
destroys the array (mxArray*
) passed to it. For example,
mxDestroyArray(A);
mxDestroyArray()
does handle a NULL
argument. However, mxDestroyArray()
does not reinitialize the mxArray*
pointer passed to it to NULL
. If you assign an array to an mxArray*
variable and subsequently delete that array by calling mxDestroyArray()
, then you must reinitialize the mxArray*
variable to NULL
before reassigning another array to that variable. If you follow the Automated Memory Management, then you avoid this awkward coding.
mlfAssign(&c, mlfScalar(5));
mxDestroyArray(c);
c = NULL;
mlfAssign(&c, mlfScalar(6));
![]() | Assigning Arrays to mxArray* Variables | Restoring the Previous Context | ![]() |