% ODSfail.m
% Running this will export the accumulated data if OilDropSpecV4.m fails to
% complete for some reason.
% After this a new session can be started with the main program.
% Tim Sesterhenn, iposita@gmail.com
% version 1: April 2, 2012

rightnow = clock;
hr = rightnow(4);
mint = rightnow(5);
nm_col = nm_range';  % makes nm_range into a column
goherexls = [directory 'ODS_' date '_' num2str(hr) num2str(mint) '.xls'];  % output file
wordscol = {'Species            ';'Sex                ';...
            'Bird ID            ';'Prep #             ';...
            'Age                ';'Eye                ';...
            'Cellular Component ';'Type               ';...
            'Lambda Mid         ';'Lambda Cut         ';...
            'Lambda 0           ';'b                  ';...
            'Bmid               ';'R Squared          ';...
            'Intercept          ';'Slope              ';...
            'Baseline Absorbance';'Peak Absorbance    ';...
            'Filename           '};
xlswrite(goherexls,wordscol,'MSPoutput','A1');
xlswrite(goherexls,nm_col,'MSPoutput','A20');
xlswrite(goherexls,zxlsoutspeci,'MSPoutput','B1');
xlswrite(goherexls,zxlsoutsex,'MSPoutput','B2');
xlswrite(goherexls,zxlsoutID,'MSPoutput','B3');
xlswrite(goherexls,zxlsoutprep,'MSPoutput','B4');
xlswrite(goherexls,zxlsoutage,'MSPoutput','B5');
xlswrite(goherexls,zxlsoutLR,'MSPoutput','B6');
xlswrite(goherexls,zxlsoutcompo,'MSPoutput','B7');
xlswrite(goherexls,zxlsouttype,'MSPoutput','B8');
xlswrite(goherexls,zoutcalcs,'MSPoutput','B9');
xlswrite(goherexls,zfilenames,'MSPoutput','B19');
xlswrite(goherexls,zoutnumbers,'MSPoutput','B20');

disp('Sorry about that. Please report any errors encountered in');
disp('the main program to Tim Sesterhenn (iposita@gmail.com). Include');
disp('a screenshot of the error or copy and paste the error text into');
disp('the email, and include any relevant data files.'
disp('Your data should be properly exported now, and you can begin a');
disp('new session with the main program.');

clear z*  % reset the export counter for spectrum.m