![]() |
VOOZH | about |
In this article, we are going to discuss "Clearing items from Memory", in MATLAB which can be done using clear operation.
The clear operation is used to clear the specified items from memory or from the currently active workspace. It is used to free up the system memory.
Syntax:
clear
clear name1 ... nameN
clear -regexp expr1 ... exprN
clear('a', 'b', 'c')
clear(['a' 'b' 'c'])
clear functions
clear mex
clear global
clear all
clear keyword
Here,
Example 1:
This example will clear all the values.
Example 2:
Output:
Variables in the current scope: Attr Name Size Bytes Class ==== ==== ==== ===== ===== A 1x1 8 double C 1x1 8 double Total is 2 elements using 16 bytes
Example 3:
Output:
Variables in the current scope: Attr Name Size Bytes Class ==== ==== ==== ===== ===== exp1 1x4 4 char exp3 1x5 5 char Total is 9 elements using 9 bytes
Example 4:
Output:
Variables in the current scope: Attr Name Size Bytes Class ==== ==== ==== ===== ===== B 1x1 8 double Total is 1 element using 8 bytes
Example 5:
Output:
Variables in the current scope: Attr Name Size Bytes Class ==== ==== ==== ===== ===== B 1x1 8 double C 1x1 8 double D 1x1 8 double Total is 3 elements using 24 bytes
Example 6:
Output:
Variables in the current scope: Attr Name Size Bytes Class ==== ==== ==== ===== ===== g A 1x1 8 double B 1x1 8 double D 1x1 8 double Total is 3 elements using 24 bytes
Example 7:
This example will clear all the values.