How Do You Clear the Console in Matlab?

How do you clear the console in MATLAB?

For example, I'm debugging a script that displays a ton of output. I want to clear the console on every run, so I don't have to look through output from old runs.

4 Answers

Short answer, the clc function:

>> clc

You can also select Edit > Clear Command Window in the MATLAB desktop (older versions) or select Clear Command Window from the Command Window pull-down menu:

>> clc %clear command

Related functions include:

>> clf %clear figure
>> cla %clear axis
>> close all %close all windows
>> clear %clear workspace of variables
2

One more option to achieve the clc is to right-clicking in the command window and choosing 'Clear command window'

There is also a default shortcut for clearing command window, which is CTRL+L. That's probably the fastest way to clear the output.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.

Share this article
Twitter Facebook Pinterest