| MATLAB Function Reference | ![]() |
mlock
mlock locks the currently running M-file or MEX-file in memory so that subsequent clear functions do not remove it.
Use the munlock function to return the file to its normal, clearable state.
Locking an M-file or MEX-file in memory also prevents any persistent variables defined in the file from getting reinitialized.
The function testfun begins with an mlock statement.
function testfun mlock . .
When you execute this function, it becomes locked in memory. You can check this using the mislocked function.
testfun
mislocked('testfun')
ans =
1Using munlock, you unlock the testfun function in memory. Checking its status with mislocked shows that it is indeed unlocked at this point.
munlock('testfun')
mislocked('testfun')
ans =
0mislocked, munlock, persistent
![]() | mlintrpt | mmfileinfo | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |