Why do I get the error message : "??? Index exceeds matrix dimensions" when trying to change directories?

1 view (last 30 days)
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.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
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.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!