Additional Information

A variable declared as persistent is local to the function in which you declare it; yet MATLAB retains its value in memory between calls to that function. Persistent variables are known only to the function in which you declare them. This prevents other functions or the MATLAB command line from changing the value of the persistent variable.

When you clear or modify a function that is in memory, MATLAB also clears all persistent variables declared by that function. To keep a function in memory until MATLAB quits, use mlock.

MATLAB returns an error if:

For more information on variables and the workspace, see Persistent Variables.