Skip to main content
Logo image

Subsection Keeping the Command Window Organized

As you work in the Command Window, MATLAB keeps a history of commands and output, and it stores variables in the workspace. Several built-in commands help you keep your session organized.
clear
clc
format short
  • clear removes all variables from the workspace.
  • clc clears the Command Window display.
  • format controls how numerical output is displayed (but not how it is stored).
These commands do not permanently undo work, but they do reset your current session. When results seem confusing, using clear and starting fresh is often helpful. As your work grows, you’ll move repeated command sequences into scripts for easy reuse.

Checkpoint 5.

Which command clears variables from memory without closing MATLAB?
  • clear
  • clc
  • format
  • exit