Main Content
mlock
Prevent clearing function or script from memory
Syntax
Description
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.
Examples
Tips
To lock a MEX file, use the
mexLock
function.
Extended Capabilities
Version History
Introduced before R2006a
See Also
mislocked
| munlock
| inmem
| persistent