how to use command "dir"
5 次查看(过去 30 天)
显示 更早的评论
Hi guys,
When using command "dir", there always includes '.', '..'.
Is there a way to eliminate these two items when using command "dir"(not postprocess)?
Thanks,
Zhong
0 个评论
回答(2 个)
Walter Roberson
2011-11-23
You can only do that by telling dir() to match the things that you do want, rather than getting the list of everything and throwing away what you do not want.
For example, dir('*.mat') instead of dir('*') and assuming that everything you get back will be a .mat file.
If you are using dir('*') you should be putting in protective checks for '.' and '..' and for sub-directories (folders) and for (e.g.,) README.txt files that describe the content of the directory.
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!