Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between clc and clear all in Matlab?

Tags:

matlab

I am new to MATLAB and was going through some machine learning projects written in MATLAB. Some files start with the following lines:

clear all;
close all;
clc;

I understand that these lines together render a clean work space. Also, that close all is used to close all figures.

If both the clear all and clc are used to clear command window, then what is the difference between the two?

like image 892
Amita Avatar asked Apr 12 '16 14:04

Amita


1 Answers

The help for both are quite thorough.

In short:

clc - clears the command window

clear all clears variables, but it also clears a lot of other things from memory, such as breakpoints, persistent variables and cached memory - as your new to Matlab this is probably a bit unclear.

In short: You rarely need to use clear all - most of the time a simple clear will be enough.

like image 95
matlabgui Avatar answered Sep 19 '22 16:09

matlabgui