Running R2012a (7.14.0.739) through Windows Parallels (Windows 7), and getting this error.
>>folder_name=uigetdir;
>>cd folder_name;
Error using cd
Cannot CD to folder_name (Name is nonexistent or not a directory).
The odd thing is that I can manually set the working directory path if I copy and paste the 'folder_name' result in the Matlab GUI's folder field.
No problems with starting up Matlab, and no customization of startup.m or pathdef.m have been made. What is the source of this problem? What is a workaround? Thanks!
You are using cd in its "command form". Therefore, Matlab understands cd folder_name as cd-ing to a folder called "folder_name". In "command form" matlab does not evaluate the variable name to see what is the string that is stored in the variable folder_name.
You need to use cd in its "function form":
cd( folder_name )
This way matlab understands that folder_name is a variable name and not the actual name of the folder.
For better understanding, cosider the difference between:
>> cd( folder_name )
and
>> cd( 'folder_name' )
the
cd( 'folder_name' ) is the "function form" equivalent of the "command form"cd folder_name`.
type:
edit pathdef.m
and remove the files with the errors, I just commented them out and my errors went away.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With