It is important to note that this time does not change no matter where you are geographically located, which is why it is useful for online applications that are tracking time. This is really just the bash equivalent of what you would expect: 719529 is the datenum of the epoch ( or datenum(1970,1,1) in MATLAB). Epoch time, also known as Unix time or POSIX time, is the amount of time in seconds that has elapsed since January 1st, 1970 (00:00:00 UTC). Here is what I settled on for the rounded date number: TODAY_MATLAB="$]" Today I found myself wanting to do the conversion to date in MATLAB as the title says - without the datestring conversion specified in the question body - and output the date number from the shell. Serg's answer is what I normally use, when I'm working in MATLAB. You can always convert it to string using datestr() To summarize, here are two functions: function tm = unix2matlab(tu) > time_matlab_string = datestr(time_matlab, 'yyyymmdd HH:MM:SS.FFF')Ģ) 8.64e7 is number of milliseconds in a day.ģ) Matlab does not apply any time-zone shifts, so the result is the same UTC time.Ĥ) Example for backward transformation: > matlab_time = now > time_matlab = time_reference + time_unix / 8.64e7 Suppose, you start with a vector time_unix, then: > time_unix = 1339116554872 % example time
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |