To clear all variables except one in MATLAB, use the clearvars
function followed by the name of the variable that you want to keep.
Here is an example of how to do it:
main.m99 chars8 lines
After running this code, the variables a
and c
will be cleared from the workspace, while b
will remain.
gistlibby LogSnag