Skip to content

clear

Clearing variables

clear

clear('all')

clear('variables')

  • All of the above statements clear all user-defined variables in the workspace, and free the memory spaces occupied by them.
  • NOTE: Command syntax, e.g., clear all, is not supported.

clear(v1, v2, v3, ..., vn)

  • v1, v2, ..., vn are character arrays of variable names. This statement clears the listed variables in the workspace, and free the memory spaces occupied by them.
  • All input arguments should be non-empty arrays.

Example 1:

a = 1
b = 2
clear('a', 'b')
a =
 1.000

b =
 2.000

Variable "a" cleared.

Variable "b" cleared.