Why did CD folder; give such a goofy error message when I just forgot ()
Show older comments
It works other places but suddenly I can change directory
K>> apploc
apploc =
'C:\Users\CPSLab\Documents\OdorChoiceDev\'
K>> cd apploc
Error using cd
Unable to change current folder to 'C:\Users\CPSLab\Documents\OdorChoiceDev\apploc' (Name is
nonexistent or not a folder).
Why did it add the variable name to the value of the variable instead of just reminding me I forgot the parentheses
cd (apploc)
1 Comment
Accepted Answer
More Answers (1)
Because
cd apploc
is equivalent to,
cd('apploc')
This is a general thing in Matlab function-calling syntax. For any function func() taking char vector arguments, the syntax,
func('arg1','arg2','arg3',...)
is equivalent to,
func arg1 arg2 arg3 ...
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!