clearvars
Clear variables from memory
Syntax
Description
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.
clearvars -regexp removes
variables with names that match the specified regular
expressions. variables
clearvars ___ -except -regexp
removes variables except those with names that match the specified regular
expressions.keepVariables
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.
Examples
Input Arguments
Version History
Introduced in R2008a