- relative path names
- the '.' notation refers to the current directory.
what is the difference between pwd and cd ?
20 次查看(过去 30 天)
显示 更早的评论
what is the difference between pwd and cd ? I get the same folder when I tyoe command in MATLAB.
0 个评论
回答(1 个)
Stephen23
2016-3-21
编辑:Stephen23
2016-3-21
Actually pwd just calls cd internally, so there is no real difference.
However I would suggest using pwd: Changing directories is a very slow way to write code (it is much faster to pass relative/absolute paths to any functions that access files of any kind), so using pwd has the advantage that it stylistically make it clear "this does NOT change the directory, we just need the path...".
In other words, using pwd encourages better programming habits.
Some faster alternatives to cd / pwd:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 File Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!