clear .mat in matlab code example
Example 1: clear all but matlab
clearvars -except NAME
Example 2: matlab clear all
clear % Clears all variable data
clc % Clears the command line window
clearvars -except NAME
clear % Clears all variable data
clc % Clears the command line window