% packageResults.m

function packageResults ( parameters )

if ( parameters.packageResults )
  disp('Packaging results into the results directory.');
else
  disp('Skip packaging results into the results directory.');
  return; 
end
  
dirName = 'results';

%% If an old results directory exists, move it
if exist( dirName , 'dir' )
  dateStr = datestr(now, 'yyyymmdd_HHMMSS');
  moveDirName = ['resultsOld_' dateStr];
  movefile(dirName, moveDirName);
end

%% Create the results directory and move all the files into it
mkdir( dirName );
[a,b,c] = movefile ( '*.png', dirName );
[a,b,c] = movefile ( 'positionAnalysis.html', dirName ); 
[a,b,c] = movefile ( 'positionAnalysisVertical.html', dirName ); 
[a,b,c] = movefile ( 'stats.txt', dirName ); 

end
