I have many folder names with spaces in it, ie "red dog" --> "c:\red dog\"
files = dir
str = ['cd ', files(3).name]
eval(str)
The execution returns the error do to the space:
>> eval(str)
Error using cd
Too many input arguments.
What is the work around?... thx
Do you have a reason for using eval?  Try just
cd(files(3).name);
                        Try using cd(files(3).name) instead of cd files(3).name (this is, call the cd function using brackets).
If for some reason you want to use cd as a command and not as a function (cd myPath instead of cd(myPath)), you have to enclose the string in single quotation marks. This way your example would look like this:
str = ['cd ''', files(3).name '''']
eval(str)
                        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