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에서 Deep Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!