* You are viewing Posts Tagged ‘POSIXct’

Converting MATLAB and R date and time values

For some unknown reason, MATLAB codes its date/time values as the number of elapsed days starting from January 1 in the year 0000. R uses the equally arbitrary, but much more widespread POSIX/Unix epoch as a reference for time keeping, so that R’s POSIX time values are stored internally as the elapsed seconds since 00:00 January 1, 1970. Converting back and forth between the two values requires just a bit of doing.

Inside R, converting from the MATLAB ‘datenum‘ value into the R POSIXt standard is fairly straightforward: Subtract 719529 from your MATLAB datenum to get the … Continue Reading