This change has been incorporated into the documentation in Release 2011b (R2011b). For previous releases, read below for any additional information:
"userpath" is a reserved function name in MATLAB and is needed to reference the MATLAB path. Creating a variable with a same name shadows the userpath function. Therefore the ability to use userpath as a normal MATLAB variable, and index or cd into it is not available in MATLAB.
To work around this issue, store the result of userpath in a variable and then perform the desired operation on it.
For instance:
a=userpath;
a=a(1:end-1);
cd(a);
Best Answer