MATLAB: Do I get the error message : “??? Index exceeds matrix dimensions” when trying to change directories

cdchangedimensionsdirectoryexceedsindexMATLABmatrix

When I try to change my current directory by using the MATLAB Current Directory Field in the desktop toolbar or by using the CD function at the Command Line, I receive the following error :
??? Index exceeds matrix dimensions.

Best Answer

This enhancement has been incorporated in Release 14 Service Pack 2 (R14SP2). For previous product releases, please read below for any possible workarounds:
We have verified that there is a bug in MATLAB 7.0.1 (R14SP1) in the way that directories are changed when there is a variable defined in the workspace with the name 'cd'.
To work around this issue, rename the 'cd' variable and then clear it from the workspace using the following commands:
cd1 = cd;
clear cd;
You can now access the data that was in the 'cd' variable using 'cd1' and you can successfully change directories.
To avoid this error in the future, use variable names that are not same as function names.