Using the C Math Library    

Deleting Bound Arrays 

You must explicitly delete:

mxDestroyArray() destroys the array (mxArray*) passed to it. For example,

destroys array 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.


 Assigning Arrays to mxArray* Variables Restoring the Previous Context