📄 getfilelist.m
字号:
function filelst = getfilelist(pathn, ext)
% GETFILELIST Get the file list of the given path and ext. For internal use.
%
% filelst = getfilelist(pathn, ext)
% pathn path name
% ext extended name of the file
%
% Return value:
% filelst the file list (cell)
%
% Copyright 2002
% Bi Xiangjun, Dalian University of Technology ( DUT )
% $Revision: 1.5 $ $Date: 2005/04/30 $
% If no file was found, filelst = [] is considered in version 1.5.A: Qu.
tmp = dir(pathn);
[m,n]=size(tmp);
if (exist('ext')~=1)
ext='';
end
if (isempty(ext))
tmpext = '';
elseif (ext(1) ~= '.')
tmpext=strcat('.',ext);
else
tmpext=ext;
end
[x,t]=size(tmpext);
if(t~=0)
tmpext=tmpext(1,t:-1:1);
end
n=0;
for i=1:m
if (~tmp(i).isdir)
[x,t]=size(tmp(i).name);
x = findstr(tmp(i).name(1,t:-1:1), tmpext);
if (isempty(x))
x=0;
end
if (isempty(ext)|x==1)
n=n+1;
filelst{n}=tmp(i).name;
end
end
end
if n == 0
filelst = [];
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -