%% sub-function for running classification per participant on cluster

function cleanit

% find files to delete
delwhat     =   { '*.e*', '*output.mat', '*.o*'};
fl          =   [];
for d = 1:length(delwhat)
    fl = [fl; dir( delwhat{d})]; %#ok<AGROW>
end

% delete files
for n = 1:length(fl)
    fl(n).name;
    if ~strcmp( fl(n).name( end-3), '.') || strcmp( fl(n).name(1:6), 'surgay')
        delete( fl(n).name)
    end
end

end