clc

Clears the Command Window.

Category: Language Fundamentals > Entering Commands

Syntax

clc

Erases the text shown in the command window and moves the prompt to the top.

Description

clc only clears what is displayed. Variables stay in the workspace; use clear to remove those. It is often placed at the top of a script so that each run starts with a clean display.

Example

disp('before')
clc
disp('after')
Output
before
after

Notes

Typed at the command line, clc clears the command history shown there. Inside a running script it has no effect on the output.

See also

home clear close format