issues of Sensitive in 'dir' function
显示 更早的评论
There is a file named abc.m, but I'm not sure the name is abc.m or Abc.m.
How to determine the true name of file?
I have a test with the true name of file is abc.m
a=dir('abc.m') %a.name=abc.m
and
b=dir('Abc.m') %b.name=Abc.m,
So, I don't know how to deal this question.
1 个评论
Walter Roberson
2013-1-28
Is your filesystem case sensitive?
采纳的回答
更多回答(1 个)
Azzi Abdelmalek
2013-1-28
编辑:Azzi Abdelmalek
2013-1-28
d=dir('*.m');
f1=char(d.name);
f=upper(f1);
idx=find(cellfun(@(x) isequal(x,upper('Abc.m')),cellstr(f)));
out=f1(idx,:)
1 个评论
Jan
2013-1-28
There is no reason to convert the names into a CHAR matrix f1. Instead of ISEQUAL inside a CELLFUN, STRCMPI compares directly.
类别
在 帮助中心 和 File Exchange 中查找有关 File Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!