No BSD License  

Highlights from
htmltool

htmltool

by

 

The HTML Toolbox (HT) stores various crosslink information about Matlab programs using HTML.

diread(direc,string,ext)
function strmat = diread(direc,string,ext)
% strmat = diread(dir,string,ext)
% Returns a matrix of strings, strmat, which
% contains all the names of the files in the
% directory dir satisfying [string*.ext]
% Don't run this program on the same search
% repeatedly ...strange things happen. Make
% sure if problems occur that tmp001 file is
% deleted.
%
here = pwd;
gto1 = ['cd ',direc];
gto2 = ['cd ',here];
eval(gto1);
% we allow for filenames of N characters wide
N=80;
%strmat = zeros(1,N);
 strmat = blanks(N);
str = ['dir ',string,'*.',ext];
if exist([direc,'\tmp001'])==2,
 disp('Deleting file');
 str2 = ['!del ',direc,'\tmp001']
 eval(str2)
end;

diary tmp001
eval(str);
diary off
clc
fid = fopen('tmp001','r');
%for i = 1:3
% fgetl(fid);
%end;

L=0;
stop=0;
k=1;
while stop ~=1
 inp = fscanf(fid,'%s',1);
 if length(inp) == 0,
 break  
 elseif length(deblank(inp)) == 5
  if deblank(inp) == 'diary'
  break
  end;
 end;
 strmat(k,1:length(deblank(inp)))=inp;
 k=k+1;
 L(k) = length(deblank(inp));
end;

if max(L) >0,
 strmat = strmat(:,1:max(L));
end;

fclose(fid);
eval(gto2);






Contact us