MATLAB: Clear, clear all and tic toc time

clearclear alltic toc time

Hello everyone, What is the difference between ''clear;'' and ''clear all;'' when starting an algorithm? As i see, ''clear all;'' takes much time and erases everything in workspace.

Best Answer

clear Clear variables and functions from memory.
clear removes all variables from the workspace.
clear VARIABLES does the same thing.
clear GLOBAL removes all global variables.
clear FUNCTIONS removes all compiled MATLAB and MEX-functions.
clear ALL removes all variables, globals, functions and MEX links.
clear ALL at the command prompt also clears the base import list.