If you want to clear a persistent
from outside of the function within which it's defined, then you need to clear
the function itself:
clear functionNameWithPersistentVariable
Or clear all (unlocked) functions from memory:
clear functions
If the function in question is actually a method of a class, you may need to use clear classes
instead. See also this table in the documentation for clear
.
Within the function itself you may be able to use whos
and something like the suggestion in this Matlab Central answer. Unfortunately, I don't know of any elegant documented way to find or list functions or persistent variables that are currently in memory.