a='C:\code'. cd 'C:\code' works fine but cd a gives error: Name is nonexistent or not a directory
2 次查看(过去 30 天)
显示 更早的评论
How can I pass a "a" as address to change directory not the whole address?
0 个评论
采纳的回答
Steven Lord
2019-10-11
The following two cd calls do the same thing, changing directory to a directory named a.
cd a
cd('a')
The following two cd calls do the same thing, changing directory to the directory c:\code.
a = 'c:\code';
cd(a)
cd c:\code
The first set of cd calls does not do the same thing as the second set of cd calls.
See this documentation page for a description of how to use either the command syntax or the function syntax to call a function.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Adding custom doc 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!