file name recognition
Show older comments
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?
Accepted Answer
More Answers (1)
Walter Roberson
on 17 Nov 2011
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
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!