function [] = cmbfast_clean(param)

% =========================================================================
% cmbfast_clean.m - A helper routine to erase output files from CMBFAST
% Last modified: January 25, 2006
% Judd D. Bowman
%
% This function deletes the output files generated by CMBFAST.  Pass to it
% the 'param' structure from cmbfast.m to delete the files associated with
% a particular run of CMBFAST.
%
% INPUT
% =====
% param = the output structure from cmbfast(...) that contains the file names
% and parameters for a specific run of CMBFAST.
%
% OUTPUT
% ======
% None
%
% =========================================================================

if (iscell(param.ftf))
	for n = 1:length(param.ftf)   
        if (exist(param.ftf{n}) > 0)
            delete(param.ftf{n});
        end
	end
elseif (exist(param.ftf) > 0)
    delete(param.ftf);
end
    
if (exist(param.fcl) > 0)
    delete(param.fcl);
end

if (exist(param.fgl) > 0)
    delete(param.fgl);
end

if (exist(param.tcl) > 0)
    delete(param.tcl);
end

if (exist(param.fts) > 0)
    delete(param.fts);
end

if (exist(param.fpa) > 0)
    delete(param.fpa);
end

