clc - Clear Command Window - MATLAB (original) (raw)
Main Content
Syntax
Description
clc
clears all the text from the Command Window, resulting in a clear screen. After running clc
, you cannot use the scroll bar in the Command Window to see previously displayed text. You can, however, use the up-arrow key ↑ in the Command Window to recall statements from the command history.
Use clc
in a MATLAB® code file to always display output in the same starting position on the screen.
Examples
Clear all text from the Command Window before running a command.
Create a 8-by-8 matrix of random numbers.
ans =
0.5241 0.3429 0.4210 0.3993 0.6164 0.6077 0.4169 0.5554
0.1202 0.6382 0.0921 0.6976 0.2690 0.9480 0.3801 0.8463
0.1778 0.3430 0.0240 0.2037 0.5597 0.0596 0.2133 0.4081
0.7061 0.2165 0.4911 0.6663 0.9448 0.2687 0.3829 0.4620
0.8314 0.7862 0.2783 0.4431 0.7145 0.9867 0.0297 0.8263
0.0348 0.7231 0.3398 0.4333 0.6792 0.7722 0.4723 0.9912
0.7578 0.2788 0.2873 0.1752 0.9594 0.4754 0.3334 0.5239
0.9571 0.5824 0.1709 0.1932 0.7753 0.6809 0.9758 0.9254
Clear all text from the Command Window.
Create a 5-by-5 matrix of random numbers.
ans =
0.0499 0.6014 0.6535 0.2990 0.0983
0.5459 0.7896 0.4897 0.2561 0.8596
0.9432 0.7992 0.9729 0.8866 0.0276
0.3215 0.0496 0.7485 0.4468 0.8992
0.8065 0.2832 0.5678 0.8160 0.8999
Version History
Introduced before R2006a