Clear variables from memory
clearvars removes all variables from the
currently active workspace.
clearvars removes
the variables specified by variablesvariables. If any of
the variables are global, clearvars removes these
variables from the current workspace only, leaving them accessible
to any functions that declare them as global.
clearvars -except removes
all variables, except for those specified by keepVariableskeepVariables.
Use this syntax to keep specific variables and remove all others.
clearvars removes
the variables specified by variables -except keepVariablesvariables, and does
not remove the variables specified by keepVariables.
This syntax allows you to use a combination of variable names, wild
card characters, or regular expressions to specify variables to remove
or keep.
clearvars -global ___ removes
the specified global variables from the workspace, including those
made global within functions, using any of the input arguments in
the preceding syntaxes. The -global flag must be
first in the argument list.