function [] = m2html1(dir,string,filename,overhead)
% [] = m2html1(dir,string,filename,overhead)
% Searches thorugh directory dir and finds all
% m-files with name string*.m and makes a html file
% called filename.html containing a list of HREFS to
% each file using the name of each file as link-name
% This is the first of several matlab to HTML tools
% and therefore the most simple one.
%
% INPUT PARAMETERS
% string = all files beginning with string*.ext
% ext = file extension
% overhead = the title of the document, e.g. HOW FILE
%
% Copyright (c) 1996, B.K. Alsberg
%
fid = fopen([filename,'.html'],'w');
directory = pwd;
M=diread(dir,string,'m');
[n,m]=size(M);
%%%%%%%% First we write the HTML header info %%%%%%%%%
s(1,:) = '<HTML> ';
s(2,:) = '<HEAD> ';
s(3,:) = ' <TITLE>/</TITLE> ';
s(4,:) = ' <META NAME="GENERATOR" CONTENT="MATLAB2HTML "> ';
s(5,:) = '</HEAD> ';
s(6,:) = '<BODY> ';
s(7,:) = '</BODY> ';
s(8,:) = '</HTML> ';
for j = 1:6
fprintf(fid,'%s \n',s(j,:));
end;
fprintf(fid,'%s \n',['<CENTER><P><FONT SIZE=+3>',overhead,'</FONT></P></CENTER>']);
fprintf(fid,'%s \n',['<CENTER><P><FONT SIZE=+1>Directory:',directory,'</FONT> </P></CENTER>']);
fprintf(fid,'%s \n','<HR WIDTH="100%"></P>');
fprintf(fid,'%s \n','<P>');
fprintf(fid,'%s \n','<UL>');
for i =1:n
nam = deblank(M(i,:));
str = ['<LI><A HREF ="',nam,'">',nam,'</A></LI>'];
fprintf(fid,'%s \n',str);
end;
fprintf(fid,'%s \n','</UL>');
fprintf(fid,'%s \n','<HR WIDTH="100%"></P>');
for j = 7:8
fprintf(fid,'%s \n',s(j,:));
end;
fclose(fid);