MATLAB: RESTOREDEFAULTPATH doesn’t restore default path (rather restores user’s path)

restoredefaultpath

The first sentence on the help screen for restoredefaultpath is
%RESTOREDEFAULTPATH Restores the MATLAB search path to installed products.
% RESTOREDEFAULTPATH sets the search path to include only folders for
% installed products from MathWorks. Use RESTOREDEFAULTPATH when you are
% having problems with the search path.
which is precisely what restoredefaultpath doesn't do. (In the good old days it did, but not any more.)
In fact, restoredefault calls $MATLAB/toolbox/local/userpath.m which prepends a user specific path to the path.
I presume this must be what MATHWORKS intended? Can't be a bug, since it's hardcoded into restoredefaultpath.m If so, (a) could mathworks please change the description of restoredefaultpath? (b) why? (c) is there a command that actually restores the default path? (d) if not, could future releases please add a flag to restoredefaultpath so that one can actually restore the default path?
Thanks, Leo

Best Answer

Further to my comment (see above), the old behaviour can be had by
restoredefaultpath; matlabpath(strrep(matlabpath, userpath, ''));
Arguably the new behaviour of restoredefaultpath is what one would expect - it now returns the default path at start up, but excludes any dynamic or path saves by the user. It now matches the behaviour of the Default button in pathtool. The userpath is just 1 location, that is in the user area of a system and not subordinate to matlabroot.