MATLAB: How to use clearvars in matlab6.5

MATLABMATLAB Builder for COMmatlab function

Hi,
I want to remove all variables from command history except specified variables in Matlab 6p5, but I use: clearvars -except D F
But it gives an error, please someone help how to use this? or which function is equal to?

Best Answer

It is a bad programming practice to control the existence of variables by clear. Better use functions to keep the workspaces clean. But if you really want to do this: Search in the FileExchange for some submissions, which work with historical Matlab versions also: