Clear variable from Memory in MATLAB
Clearing variables from memory, with the help of clearvars operation. The clearvars operation is used to clear the specified variables from memory or from the currently active workspace.
Syntax:
clearvars variables
clearvars -except keepVariables
Parameters: This function accepts a parameter.
- variables: These are the specified variables that are going to be cleared.
Example 1
Matlab
x = 5;
y = 10;
z = 15;
clearvars x y
whos
|
Output:
Example 2
Matlab
A = 5;
B = 10;
C = 15;
D = 20;
E = 25;
clearvars -except C D
whos
|
Output:
Last Updated :
04 Jul, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...