%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function lastMJD = lastAlphaValue() Get the last (non-flagged) MJD value in alpha database. This is useful if you want to make sure that the alpha database can be applied to your data. I/O: MAS -- 28-Nov-2012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function lastMJD = lastAlphaValue() 0002 0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0004 % 0005 % function lastMJD = lastAlphaValue() 0006 % 0007 % Get the last (non-flagged) MJD value in alpha database. This is 0008 % useful if you want to make sure that the alpha database can be applied 0009 % to your data. 0010 % 0011 % 0012 % I/O: 0013 % 0014 % MAS -- 28-Nov-2012 0015 % 0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0017 0018 [home installeddir] = where_am_i(); 0019 constantsDir = [home '/' installeddir '/constants/alphaDatabase_*.txt']; 0020 0021 0022 alphaDatabaseFiles = dir(constantsDir); 0023 0024 0025 k = 0; 0026 lastMJD = 0; 0027 while lastMJD == 0; 0028 0029 % Grab the last file in the alpha database. 0030 lastFile = alphaDatabaseFiles(end).name; 0031 d = importdata(lastFile,' ',1); 0032 0033 0034 if sum(d.data(:,58) == 0) > 0 0035 lastMJD = max(d.data(d.data(:,58) == 0, 1)); 0036 else 0037 k = k + 1; 0038 end 0039 0040 end 0041 0042 end