readdir.m 501 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
function [varargout] = readdir();
%Read working directory with no arguments. Output depends on the function call
% 
%
fdir = fopen('./dirnames.dir','r');
%strippintg comment lines if any
header=fgetl(fdir);
if header(1)=='%'
   while header(1)=='%'
      header=fgetl(fdir);
   end
   varargout(1)= {header};
   for i=2:nargout 
      varargout(i)= {fgetl(fdir)};
   end
else
   frewind(fdir)
   for i=1:nargout 
      varargout(i)= {fgetl(fdir)};
   end
end
fclose(fdir);
return