date= mjd2date_v2(mjd) just like mjd2date(mjd) except this returns a structure ML
0001 function date= mjd2date_v2(mjd) 0002 0003 % date= mjd2date_v2(mjd) 0004 % 0005 % just like mjd2date(mjd) except this returns a structure 0006 % 0007 % ML 0008 0009 nargsin = nargin; 0010 error(nargchk(1, 1, nargsin)); 0011 0012 % We could have got everything by just using 0013 % 0014 % jd = mjd2jd(mjd); 0015 % [year, month, day, hour, minute, second] = jd2date(jd); 0016 % 0017 % but we lose precision in the fraction part when MJD is converted to JD 0018 % because of the large offset (2400000.5) between JD and MJD. 0019 % 0020 % 05-Apr-2011 (MAS): changed to above method, as a round-off error can 0021 % occur when date and time are calculated separately. Try, for instance, 0022 % an mjd of 55493.9999999998. 0023 0024 %jd = mjd2jd(mjd); 0025 %[year, month, day] = jd2date(jd); 0026 % 0027 %fmjd = mjd - floor(mjd); 0028 %[hour, minute, second] = days2hms(fmjd); 0029 0030 jd = mjd2jd(mjd); 0031 [year, month, day, hour, minute, second] = jd2date(jd); 0032 0033 0034 date.year=year; 0035 date.month=month; 0036 date.day=day; 0037 date.hour=hour; 0038 date.minute=minute; 0039 date.second=second; 0040 0041 0042