0001 function [fpath, fname] = vb_get_ext_fname(dname,ext,prefix)
0002
0003
0004
0005
0006 if nargin==1, ext = ''; end;
0007 if nargin < 3, prefix = ''; end;
0008
0009 df = dir([dname '/*' ext]);
0010
0011 fpath = [];
0012 fname = [];
0013 Nfile = length(df);
0014 nf = 0;
0015
0016 for n=1:Nfile
0017 if df(n).isdir==0,
0018 fn = df(n).name;
0019 if isempty(prefix) || any(strfind(fn,prefix) == 1),
0020 nf = nf + 1;
0021 fpath{nf} = [dname filesep fn];
0022 if ~isempty(ext),
0023 fn = fn(1:strfind(fn,ext)-1);
0024 end
0025 fname{nf} = fn;
0026 end
0027 end
0028 end