MATLAB Function Reference | ![]() ![]() |
Syntax
Description
locks the currently running M-file in memory so that subsequent mlock
clear
functions do not remove it.
Use the munlock
function to return the M-file to its normal, clearable state.
Locking an M-file in memory also prevents any persistent
variables defined in the file from getting reinitialized.
Examples
The function testfun
begins with an mlock
statement.
When you execute this function, it becomes locked in memory. This can be checked using the mislocked
function.
Using munlock
, you unlock the testfun
function in memory. Checking its status with mislocked
shows that it is indeed unlocked at this point.
See Also
mislocked
, munlock
, persistent
![]() | mkpp | mod | ![]() |