views:

1260

answers:

3

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.

+11  A: 

Short answer, the CLC function:

>> clc

You can also select Edit > Clear Command Window in the MATLAB desktop.

gnovice
+7  A: 
>> clc %clear command

Related functions include:

>> clf %clear figure
>> cla %clear axis
>> close all %close all windows
>> clear %clear workspace of variables
MatlabDoug
Years ago, I always found myself typing "closeall", instead of "close all". Lazy fingers, but it naturally generates an error. The simple solution was to create a simple idiom, the closeall function on my system. Problem solved.
woodchips
We used to have a function SHG (Show Graphics) from when computers were either in text or graphics mode. We then made SHG bring up the figure. In an effort to simplify the language we got rid of the command since figure(gcf) did the same thing. Well, after one release of complaints...>>edit shgSo you are not alone woodchips... :)
MatlabDoug
+1  A: 

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

Jonas Hallgren