file name recognition
2 次查看(过去 30 天)
显示 更早的评论
I have a directory wich can containn files.A XOR files.B
I need to write code to dell if the extension is A or B and based on that assign myfunct=AA() or myfunct=BB()
any suggestions appreciated?
0 个评论
采纳的回答
Fangjun Jiang
2011-11-17
[PATHSTR,NAME,EXT,VERSN] = FILEPARTS(FILE) returns the path, filename, extension and version for the specified file. FILEPARTS is platform dependent.
更多回答(1 个)
Walter Roberson
2011-11-17
filelist = dir();
filelist([filelist.isdir]) = []; %remove . and ..
for K = 1 : length(filelist)
[pathstr, name, ext, versn] = fileparts(filelist(K).name);
if strcmp(ext,"A")
myfunct = AA();
else
myfunct = BB();
end
end
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Speech Recognition 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!