MatlabCommands

From University of Washington - Ubicomp Research Page
Revision as of 04:10, 18 February 2007 by Jonathan Lester (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Overview

Some useful Matlab commands


Unix Timestamps

    The unix timestamps used in uwar files are counting the number of milliseconds since the 1/1/1970 epoch. So if we're given the timestamp 1171308738000, this corresponds to 12-Feb-2007 12:32:18.
    • to get a normal unix timestamp we need to divide by /1000.
      • 1171308738000/1000 = 1171308738 (Mon, 12 Feb 2007 19:32:18 GMT)
    • To convert this to a Matlab time (where 1.0 = 1 day since the 1/1/000 epoch), we need to convert the timestamp into days and add in the 1/1/1970 epoch offset, we use -7 to conver the data to the PST timezone
      • 1171308738000/1000/(24*60*60) + datenum( 1970,1,1,-7,0,0 ) = 733085.522430556 (12-Feb-2007 12:32:18)