% MATLAB code for variables "x"and"y"% cleared from the memory and variable "z"% will be as it is.
x =5;%Initializing
y =10;
z =15;%Calling the clearvars operation over% the x and y variables
clearvars x y
%Getting the remaining variables
whos
MATLAB
输出:
示例 2
% MATLAB code for all variables will be % cleared except"C"and"D".
A =5;%Initializing of variables
B =10;
C =15;
D =20;
E =25;%Calling the clearvars operation to% clear above variables except C and D
clearvars -except C D
%Getting the remaining variables
whos