clc
Clear Command Window
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 Output
Clear all text from the Command Window before running a command.
Create a 50-by-50 matrix of random numbers.
rand(50)
ans = 50×50
0.8147 0.2760 0.1622 0.4173 0.6443 0.9631 0.0596 0.3015 0.4229 0.9160 0.5822 0.7363 0.8507 0.1465 0.5590 0.4561 0.6837 0.1098 0.9879 0.1636 0.6312 0.9891 0.7829 0.7136 0.5038 0.2859 0.4067 0.1170 0.5038 0.0196 0.1403 0.3180 0.6723 0.6423 0.8383 0.8090 0.1982 0.2411 0.1934 0.5230 0.7449 0.3991 0.9852 0.3257 0.0560 0.1457 0.1048 0.9173 0.8169 0.9018
0.9058 0.6797 0.7943 0.0497 0.3786 0.5468 0.6820 0.7011 0.0942 0.0012 0.5407 0.3947 0.5606 0.1891 0.8541 0.1017 0.1321 0.9338 0.1704 0.6660 0.3551 0.0669 0.6938 0.6183 0.4896 0.5437 0.6669 0.8147 0.6128 0.4352 0.2601 0.6086 0.4315 0.2213 0.5847 0.3565 0.1951 0.8414 0.7544 0.3253 0.8923 0.5994 0.5595 0.6302 0.8169 0.5850 0.8584 0.5098 0.1895 0.4195
0.1270 0.6551 0.3112 0.9027 0.8116 0.5211 0.0424 0.6663 0.5985 0.4624 0.8699 0.6834 0.9296 0.0427 0.3479 0.9954 0.7227 0.1875 0.2578 0.8944 0.9970 0.9394 0.0098 0.3433 0.8770 0.9848 0.9337 0.3249 0.8194 0.8322 0.0868 0.9102 0.6944 0.8371 0.9481 0.0732 0.3268 0.8572 0.3463 0.8318 0.2426 0.8005 0.9336 0.2303 0.5289 0.0734 0.6982 0.9742 0.1237 0.3581
0.9134 0.1626 0.5285 0.9448 0.5328 0.2316 0.0714 0.5391 0.4709 0.4243 0.2648 0.7040 0.6967 0.6352 0.4460 0.3321 0.1104 0.2662 0.3968 0.5166 0.2242 0.0182 0.8432 0.9360 0.3531 0.7157 0.8110 0.2462 0.5319 0.6174 0.4294 0.9091 0.2568 0.9711 0.0610 0.5910 0.8803 0.9636 0.4186 0.8103 0.1296 0.1051 0.7203 0.5799 0.6944 0.8223 0.7337 0.1973 0.8210 0.4890
0.6324 0.1190 0.1656 0.4909 0.3507 0.4889 0.5216 0.6981 0.6959 0.4609 0.3181 0.4423 0.5828 0.2819 0.0542 0.2973 0.1175 0.7978 0.0740 0.7027 0.6525 0.6838 0.9223 0.1248 0.4494 0.8390 0.4845 0.3427 0.2021 0.5201 0.2573 0.5916 0.0098 0.8464 0.5846 0.9102 0.4711 0.4889 0.1557 0.5570 0.2251 0.8214 0.4840 0.6032 0.2124 0.7229 0.6505 0.1112 0.6379 0.2560
0.0975 0.4984 0.6020 0.4893 0.9390 0.6241 0.0967 0.6665 0.6999 0.7702 0.1192 0.0196 0.8154 0.5386 0.1771 0.0620 0.6407 0.4876 0.6841 0.1536 0.6050 0.7837 0.7710 0.7306 0.9635 0.4333 0.7567 0.3757 0.4539 0.8639 0.2976 0.3326 0.5323 0.5060 0.2851 0.1938 0.4040 0.2203 0.8190 0.2630 0.3500 0.8411 0.6390 0.5999 0.5433 0.9259 0.5163 0.2974 0.0161 0.9292
0.2785 0.9597 0.2630 0.3377 0.8759 0.6791 0.8181 0.1781 0.6385 0.3225 0.9398 0.3309 0.8790 0.6952 0.6628 0.2982 0.3288 0.7690 0.4024 0.9535 0.3872 0.5341 0.0427 0.6465 0.0423 0.4706 0.4170 0.5466 0.4279 0.0977 0.4249 0.8531 0.2794 0.2789 0.8277 0.4324 0.1792 0.2262 0.6249 0.6806 0.2871 0.3545 0.8876 0.4484 0.7025 0.4926 0.3264 0.3964 0.8960 0.4668
0.5469 0.3404 0.6541 0.9001 0.5502 0.3955 0.8175 0.1280 0.0336 0.7847 0.6456 0.4243 0.9889 0.4991 0.3308 0.0464 0.6538 0.3960 0.9828 0.5409 0.1422 0.8854 0.3782 0.8332 0.9730 0.5607 0.9718 0.5619 0.9661 0.9081 0.1192 0.4424 0.9462 0.7466 0.1910 0.7492 0.9689 0.5368 0.7386 0.2337 0.9275 0.4301 0.1987 0.0354 0.9564 0.6549 0.6618 0.4208 0.5154 0.2540
0.9575 0.5853 0.6892 0.3692 0.6225 0.3674 0.7224 0.9991 0.0688 0.4714 0.4795 0.2703 0.0005 0.5358 0.8985 0.5054 0.7491 0.2729 0.4022 0.6797 0.0251 0.8990 0.7043 0.3983 0.1892 0.2691 0.9880 0.3958 0.6201 0.1080 0.4951 0.9044 0.9064 0.2369 0.4425 0.0392 0.4075 0.7621 0.8051 0.4564 0.0513 0.5722 0.3954 0.5138 0.4445 0.8901 0.1176 0.3115 0.5445 0.4312
0.9649 0.2238 0.7482 0.1112 0.5870 0.9880 0.1499 0.1711 0.3196 0.0358 0.6393 0.1971 0.8654 0.4452 0.1182 0.7614 0.5832 0.0372 0.6207 0.0366 0.4211 0.6259 0.7295 0.7498 0.6671 0.7490 0.8641 0.3981 0.6954 0.5170 0.7064 0.0332 0.3927 0.9573 0.3934 0.9463 0.8445 0.3476 0.0672 0.3846 0.5927 0.7008 0.9922 0.4077 0.0854 0.5385 0.1478 0.6938 0.6064 0.7025
⋮
Clear all text from the Command Window.
clc
Create a 10-by-10 matrix of random numbers.
rand(10)
ans = 10×10
0.8558 0.9390 0.9262 0.6279 0.4374 0.8884 0.8964 0.2442 0.8149 0.1398
0.6708 0.8154 0.2985 0.4504 0.7462 0.2332 0.4822 0.4290 0.1405 0.7519
0.5236 0.0014 0.3381 0.4736 0.4679 0.8616 0.0141 0.0102 0.8799 0.2418
0.2988 0.0031 0.8595 0.9497 0.8608 0.7117 0.6229 0.6088 0.0954 0.6505
0.7040 0.0875 0.3405 0.0835 0.4665 0.8728 0.2311 0.9580 0.3526 0.8574
0.3816 0.2607 0.1381 0.2798 0.4981 0.9380 0.5274 0.0954 0.5934 0.0844
0.5677 0.0228 0.5078 0.4470 0.4874 0.1397 0.7250 0.0356 0.5852 0.9721
0.8879 0.4241 0.8567 0.5876 0.2295 0.3939 0.6074 0.8862 0.6677 0.0315
0.8429 0.3411 0.3843 0.8776 0.0856 0.9806 0.5884 0.2469 0.6480 0.8354
0.8988 0.5414 0.6957 0.4691 0.0674 0.6448 0.4334 0.0089 0.4334 0.8357
Version History
Apri esempio
Si dispone di una versione modificata di questo esempio. Desideri aprire questo esempio con le tue modifiche?
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)