Prevent clearing function or script from memory
mlock
locks the currently running function in memory. Locking a function prevents clear
from removing it from memory, and prevents reinitialization of any persistent
variables defined in the file.
Use mlock
only within a MATLAB® code file.
To remove a locked function or script from memory, first unlock it using the munlock
command, and then use the clear
command.
To lock a MEX file, use the mexLock
function.
inmem
| mislocked
| munlock
| persistent