|MATLAB Function Reference|
Prevent M-file clearing
locks the currently running M-file in memory so that subsequent
clear functions do not remove it.
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.
testfun begins with an
When you execute this function, it becomes locked in memory. This can be checked using the
munlock, you unlock the
testfun function in memory. Checking its status with
mislocked shows that it is indeed unlocked at this point.