Main Content

mislocked

Determine if function or script is locked in memory

Description

tf = mislocked(fun) returns true (logical 1) if the function or script fun is locked in memory. Otherwise, it returns false (logical 0).

example

tf = mislocked returns true (logical 1) if the currently running function is locked in memory. Otherwise, it returns false (logical 0).

Use this syntax only within a MATLAB® code file.

example

Examples

collapse all

Check if the function plot is locked in memory.

tf = mislocked('plot')
tf =

  logical

   0

Create the function myFun in your current working folder. The function calls mislocked on itself to find out if it is locked in memory before and after a call to mlock.

function myFun()
    isLockedBefore = mislocked
    mlock
    isLockedAfter = mislocked
end

At the command prompt, call the function.

myFun
isLockedBefore =

  logical

   0


isLockedAfter =

  logical

   1

Unlock the function so it can be cleared from memory. Verify that the function is not locked.

munlock('myFun')
tf = mislocked('myFun')
tf =

  logical

   0

Input Arguments

collapse all

Name of function or script, specified as a character vector or a string scalar.

Tips

  • To remove a locked function from memory, first unlock it using the munlock function, and then clear it from memory using the clear function.

  • To determine if a MEX file is locked in memory, use the mexIsLocked function.

Extended Capabilities

Version History

Introduced before R2006a

See Also

| |