Skip to content

clear

Remove items from the workspace.

clear
clear(name1, name2, ...)
clear all
clear functions
clear global

Without arguments, removes all variables from the current workspace (functions and global state are preserved). With one or more names, removes only those. Special keywords:

  • 'all' — remove everything (variables, functions, classes)
  • 'functions' — clear cached function definitions (forces re-parse on next call)
  • 'global' — remove global variables
  • 'classes' — clear class definitions
clear
clear x y z
clear all
  • who — List names of variables in the workspace.
  • whos — List variables in the workspace with detailed info.
  • clc — Clear the command-window display.