0001 function recalcList = ...
0002 idTemplateUpdates(oldMjdList,newMjdList,oldEndMJD,newEndMJD, ...
0003 changeList)
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 recalcList = zeros(length(changeList),1);
0026
0027 for k=find(changeList')
0028
0029
0030 if k < length(newMjdList)
0031 newLen = newMjdList(k+1) - newMjdList(k);
0032 else
0033 newLen = newEndMJD - newMjdList(end);
0034 end
0035
0036
0037 switch changeList(k)
0038 case 1
0039 fprintf( ...
0040 ['\nNew template beginning ' mjd2string(newMjdList(k)) ...
0041 '\ncreated with length %6.2f days.\n'], newLen);
0042 while 1
0043 recalc = input('Generate this template? (Y/N) ','s');
0044 if strcmpi(recalc,'y')
0045 disp(' OK. Will generate.');
0046 recalcList(k) = 1;
0047 break;
0048 elseif strcmpi(recalc,'n')
0049 disp(' OK. Will not generate.');
0050 break;
0051 else
0052 disp(' Invalid choice.');
0053 end
0054 end
0055 case 2
0056 [poo, old_k] = min(abs(oldMjdList - newMjdList(k)));
0057
0058 if old_k < length(oldMjdList)
0059 oldLen = oldMjdList(old_k+1) - oldMjdList(old_k);
0060 else
0061 oldLen = oldEndMJD - oldMjdList(old_k);
0062 end
0063
0064 fprintf( ...
0065 ['\nLength of template beginning \n' ...
0066 mjd2string(newMjdList(k)) ...
0067 ' has changed \nfrom %6.2f days to %6.2f days\n'], ...
0068 oldLen, newLen);
0069 while 1
0070 recalc = input('Re-generate? (Y/N) ','s');
0071 if strcmpi(recalc,'y')
0072 disp(' OK. Will re-generate.');
0073 recalcList(k) = 1;
0074 break;
0075 elseif strcmpi(recalc,'n')
0076 disp(' OK. Will not re-generate.');
0077 break;
0078 else
0079 disp(' Invalid choice.');
0080 end
0081 end
0082 case 3
0083 fprintf( ...
0084 ['\nTemplate beginning \n' ...
0085 mjd2string(newMjdList(k)) ...
0086 ' with length %6.2f \ncontains recalculated estimates.\n'], ...
0087 newLen);
0088 while 1
0089 recalc = input('Re-generate? (Y/N) ','s');
0090 if strcmpi(recalc,'y')
0091 disp(' OK. Will re-generate.');
0092 recalcList(k) = 1;
0093 break;
0094 elseif strcmpi(recalc,'n')
0095 disp(' OK. Will not re-generate.');
0096 break;
0097 else
0098 disp(' Invalid choice.');
0099 end
0100 end
0101 otherwise
0102 fprintf('\nHmm. Encountered an unexpected change type.\n');
0103 fprintf('Ignoring and moving on...\n');
0104 end
0105
0106 end
0107
0108
0109 end