function [fid] = IDX_mak1(index_file,htmldir,RM)
% [fid] = IDX_mak1(index_file,htmldir,RM)
% This function makes the INDEX.HTML file. One of several
% possible files dependent on the personal taste of the user.
%
% INPUT PARAMETERS
%
% index_file = file name of the top node HTML file which
% contains the links to all the other m-files.
% htmldir = current directory containing the html files
% RM = A matrix of strings. Each row is an m-file name
%
% OUTPUT PARAMETER
%
% fid = the returned file pointer to the final index file
%
% Copyright (c) 1996 B.K. Alsberg
%
%% Here we initialize the parameters to the signature file by %%%%%
%% reading from the initialization file htini.dat %%%%%
[Name,email,par]=iniread1;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% here performing lexical sorting %%%%%%%%%%%%%%%
%%%%%%%%%% routine by Bryce Gardner, %%%%%%%%%%%%%%%
%%%%%%%%%% gardner@ecn.purdue.edu %%%%%%%%%%%%%%%
Ref_Mat = lexsort(RM);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% str = ['cd ',htmldir]
% eval(str);
fid = fopen(index_file,'w');
[n,m]=size(Ref_Mat);
HEAD_mak(fid,' ','Index File',4,0);
fntwrt(fid,htmldir,'CENTER',2,0,[]);
fprintf(fid,'%s \n','<HR WIDTH="100%"></P>');
fprintf(fid,'%s \n','<HR WIDTH="100%"></P>');
LST_mak(fid,0,0);
for i = 1:n
ref1 = deblank(Ref_Mat(i,:));
ref1 = ref1(1:length(ref1)-2);
REF_mak(fid,ref1,[ref1,'.htm'],1);
end
LST_mak(fid,1,0);
fprintf(fid,'%s \n','<HR WIDTH="100%"></P>');
sig_wrt1(fid,Name,par,email);
fclose(fid);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%