Skip to content

clearvars

miscellaneous · scripts/miscellaneous/clearvars.m

: clearvars
: clearvars name1 name2 …
: clearvars -except name1 …
: clearvars name1 … -except ex1 …
: clearvars -regexp expr1 …
: clearvars -global …

Clear variables of the calling workspace.

Names may contain the wildcards ‘*’, ‘?’ and character classes like ‘[a-c]’, which must match the whole variable name. After ‘-regexp’ the names are regular expressions that may match anywhere in a variable name. Everything matching a name after ‘-except’ is kept. With ‘-global’ global variables are cleared instead.