function cleanup_dynare_files(modfilename)

% list of suffixes for dynare .mod file that are generated each time the
% model is parsed (and can then be deleted at little cost)
suffix_list = char('.log','.m','_dynamic.m','_results.mat','_static.m');

nsuffixes = size(suffix_list,1);

for this_indx = 1:nsuffixes
    delete([modfilename,suffix_list(this_indx,:)])
    
end


% also get rid of dyrectory with results

cmd = ['!rmdir ',modfilename,'/output'];
eval(cmd);

cmd = ['!rmdir ',modfilename];
eval(cmd);