Use clear functions
only if you need to clear all scripts
and functions. In addition to clearing scripts and functions, it also clears
persistent variables and MEX functions. Using clear functions
causes MATLAB to recompile previously cached code, and can decrease
performance.
When possible, replace instances of clear functions
in your
code.
To clear a function or script, consider clearing only the specific
function or script. For example, clear
myFun
.
To clear only all MEX functions, consider using clear
mex
.
For more information, see clear
.