www.pudn.com > LPCToolbox.rar > LOADFILELIST.M


function Filelist = loadfilelist(filelst) 
 
Filelist = cellstr(filelst); % automatically deblanks 
if length(Filelist)==1,  
  k = findstr(Filelist{1}, '.'); 
  ext = lower(Filelist{1}(k+1:end)); 
  if strcmp(ext,'dat') | strcmp(ext,'txt') 
    Filelist = getsndfnames(Filelist{1}); 
  end 
end 
 
%------------------------------------------ 
function filelist = getsndfnames(listfname) 
 
fid = fopen(listfname, 'rt'); 
if fid < 0, 
 fprintf(1, 'Unable to read %s\n', listfname); 
 filelist = {}; return; 
end 
 
filelist = {};  
while 1, 
  line = fgetl(fid); 
  if ~isstr(line) break; end 
  line = deblank(line); 
  if ~isempty(line), filelist{end+1} = line; end 
end 
fclose(fid);