mlock
Prevent clearing function from memory
Syntax
mlock
Description
mlock
locks the currently running function in memory so that subsequentclear
functions do not remove it. Locking a function in memory also prevents anypersistent
variables defined in the file from getting reinitialized.
Use themunlock
function to return the file to its normal, clearable state.
Examples
The functiontestfun
begins with anmlock
statement.
函数testfun mlock。。
When you execute this function, it becomes locked in memory. You can check this using themislocked
function.
testfun mislocked('testfun') ans = 1
Usingmunlock
, you unlock thetestfun
function in memory. Checking its status withmislocked
shows that it is indeed unlocked at this point.
munlock('testfun') mislocked('testfun') ans = 0
See Also
Introduced before R2006a
Was this topic helpful?