MATLAB: Is it possible to ‘clear all’ variables except one clear I am using clear all command. But I wan to keep just one of the varibles. Lets say the name of that variable is 'var'. Best Answer https://in.mathworks.com/help/matlab/ref/clearvars.html#bt3p8gt-5clearvars -except var Related SolutionsMATLAB: How to Clear all Variables of a Workspace Except for Those Explicitly Excluded See doc clearvars:clearvars -except keepVariablesI recommend to use functions. Then there is no need to clear workspace variables. For larger projects it is very useful, if the workspace is kept clean, instead of applying method to clean them manually. MATLAB: How do i clear all except one variable clearvars -except NAME Related QuestionHow to load all variables from *.mat except oneRefreshdata, clf, “clear all output”How to clear a variable if “clear” is itself a variable
Best Answer