Programming and Data Types |
Characteristics of persistent variables are
clear
the function or edit the M-file for that function, then MATLAB clears all persistent variables used in that function.
You must declare persistent variables as persistent
before you can use them in a function. It is usually best to put persistent declarations toward the beginning of the function. You wouldl declare persistent variable SUM_X
as follows:
You can use the mlock
function to keep an M-file from being cleared from memory, thus keeping persistent variables in the M-file from being cleared as well.
Global Variables | Special Values |