List / view / clear constant variables in Matlab

How to list / view / clear constant variables in MATLAB? I would like to see constant variables not for a specific function, but for all functions in which constant variables are currently stored.

I tried things like whos('persistent') and whos('global') with no luck.

+6
source share
1 answer

If you want to clear persistent from outside the function in which it is defined, 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 the class class , you may need to use clear classes . See also this table in the clear documentation.

In the function itself, you can use whos and something like the sentences in this Matlab Central answer . Unfortunately, I do not know of any elegant documented way to search or list functions or constant variables that are currently in memory.

+9
source

Source: https://habr.com/ru/post/957461/


All Articles