It sounds like you're seeing this in the Editor's Linter coding tips? These are all "clear the slate" commands,
- Use clc to clean up the command window output. This command has no effect on the code you run. If you print things to the screen, they'll start from a clean command window.
- Use close all to clean up any open windows (e.g. plots) before running a script. MATLAB by default will draw a new plot into either the active figure (e.g. Figure 1), or create a new figure if there isn't one available. The default behavior is to overwrite the existing plot, but if your script uses an axis hold and you don't clear it, or if you have subplots in the figure, you may see plots that contain old information or traces in the wrong spot.
- Use clear to remove variables and definitions from the workspace. A script operates on MATLAB's main workspace, so there may be unexpected behavior if you've redefined a function or variable in the workspace outside of the script. For instance (and for example only--this is generally bad practice), you could redefine sin = @(x) x+2 in a previous script that leaves it in the workspace. Calling a new script without clearing first will cause the new script to use this function instead of the transcendental it is expecting and you'll get an incorrect result.
You can safely ignore the clear all warning if you'd like, but generally the reason it recommends against "clear all" is that you remove some of the just-in-time-compilation steps that MATLAB caches for performance. Using clear (without the all) will generally erase all the variables and functions to give you a clean starting point but keep some of the under the hood optimizations. An exception to ignoring it is when you're tweaking global variables or doing class development. In those cases, you might want to be explicit about resetting the variable or class definition.
Hope this helps!