Working with dates that are seconds apart - datenum returns the exact same value. What am I doing wrong?
I'm trying to plot events on a time axis. The events are milliseconds apart. If I convert the timestamp of two events to a datenum I get the exact same result for different timestamps. See the following output:
datenum(20开发者_JS百科11,06,13,15,11,05.500)
ans =
7.3467e+005
datenum(2011,06,13,15,11,06.500)
ans =
7.3467e+005
The time between those two dates is one second apart. What am I doing wrong? Is there a way I can work with times like this?
Thanks -Daniel
Daniel, just store the data in variable, there is a a difference that's too small given your precision:
a = datenum(2011,06,13,15,11,05.500)
b = datenum(2011,06,13,15,11,06.500)
b - a
datevec(b-a)
a =
7.3467e+05
b =
7.3467e+05
ans =
1.1574e-05
ans =
0 0 0 0 0 1
精彩评论