
function makeheader(inputfilename,endog_)


endog_ = cellstr(endog_);

% load equations
equationsfile = textread([inputfilename,'.txt'],'%s', ...
          'delimiter','\n','whitespace','','bufsize',40000);

      
nendogs = length(endog_);

for i = 1:nendogs
    endog_(i) = strcat(lower(endog_(i)),{' _NOTD'});
   
end


% assemble file
file = strvcat(['MODEL > ',inputfilename],'\n','ENDOG >','\n',char(endog_),'\n',char(equationsfile),'\n','END');


% write file to disk
fid = fopen([inputfilename,'.txt'],'w+');

nfile = size(file,1);
for i = 1:nfile
    fprintf(fid,[deblank(file(i,:)),'\n']);
end

fclose(fid);
