Variables can be unassigned using the clear function.
The
clear function alone clears all variables in the workspace. All that
is entered in the command window is
clear
. There are no inputs or outputs.
clear
The
clear variables function clears all the variables in the current
workspace (see Workspace and Scoping Rules).
clear variables
The
clear global function clears all global
variables.
clear global
The
clear functions function clears all functions except those
locked.
clear functions
The
clear all function clears all variables, global variables, and
functions.
clear all
The
clear function followed by a name of a variable or function clears
the input function or variable.
clear a
clear makeSin
The
clear * function clears all variables that begin with anything
before the * in the input after the clear.
clear ma*
The
clear function can also be used to erase specific variables passed
to it:
clear('name')
clear('makeSin')
All clear functions clear those that they are designed to clear except
functions, variables, and so on, that are locked. There are functions that can be used to
unlock and lock those functions and variables .