How can I add a event to my timeseries to mark days?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hello,
I have a time series that embraces a week and in which I would like to mark when a day is completed. So, I have been reading the documentation and I found addevent method to create determined events in the time series. However, I don't know exactly how to set it to check when a day is over, let's say 24:00:00 of that day.
My time series is
dutSensorsReadings.Sensor1.timeSeriesS1.TimeInfo
tsdata.timemetadata
Package: tsdata
Non-Uniform Time:
Length 9086
Time Range:
Start 27-Jul-2018 12:01:15
End 03-Aug-2018 03:27:00
Common Properties:
Units: 'days'
Format: ''
StartDate: '27-Jul-2018 12:01:15'
Creation of the event
e1 = tsdata.event('myDays','24:00');
e1.Units = 'hours';
dutSensorsReadings.Sensor1.timeSeriesS1 = addevent(dutSensorsReadings.Sensor1.timeSeriesS1,e1);
But when calling the plot command, no event is depicted...
figure();plot(dutSensorsReadings.Sensor1.timeSeriesS1);
What am I doing wrong?
The timeseries is like this
'27-Jul-2018 12:06:29' 2.11500000000000
'27-Jul-2018 12:07:33' 2.11500000000000
'27-Jul-2018 12:08:36' 2.11500000000000
'27-Jul-2018 12:09:39' 2.11500000000000
'27-Jul-2018 12:10:42' 2.16000000000000
'27-Jul-2018 12:11:45' 2.11500000000000
'27-Jul-2018 12:12:48' 2.07000000000000
'27-Jul-2018 12:13:51' 2.07000000000000
'27-Jul-2018 12:14:54' 2.07000000000000
'27-Jul-2018 12:15:57' 2.07000000000000
'27-Jul-2018 12:17:00' 2.07000000000000
'27-Jul-2018 12:18:04' 2.07000000000000
'27-Jul-2018 12:19:07' 2.07000000000000
'27-Jul-2018 12:20:10' 2.07000000000000
'27-Jul-2018 12:21:13' 2.02500000000000
'27-Jul-2018 12:22:16' 2.02500000000000
'29-Jul-2018 00:04:07' 0
'29-Jul-2018 00:05:10' 0
Thanks in advance,
3 Commenti
Walter Roberson
il 10 Ago 2018
24:00 is a valid time on days that have leap seconds.
dpb
il 11 Ago 2018
Modificato: dpb
il 11 Ago 2018
:)
Which reminds of geezer tale -- a dedicated instrument worked on developed(*) a random crash at midnight; turned out in the particular compiler the RTC returned 24 hrs for roughly the first 30 seconds after midnight before the hour return switched to 00. An array addressing expression used the RTC hour to index into an array dimensioned 0-23. Combined with the background garbage collection which might/might not run at same time, the predictability of the crash on any given night was nil. Took me quite some time to track down the root cause. The particular compiler became obsolete with changing PC OS'es and hardware so the bug isn't still loose in the wild; we checked the particular vendor's subsequent releases and other language RTL very carefully; the one turned out to be the only one with the symptom.
(*) Part of the devilment was that the identical array-indexing code and RTC issue(+) had existed from the first deployment of the instrument; the problem only manifested itself after several years and many updates, none of which had anything specifically to do with the actual problem itself. The final straw was, in fact, simply adding a few additional message strings to the user interface screens in code that wasn't even executed except during maintenance or other offline activities; remnants of those strings when the garbage collection ran was what actually trashed the memory the out-of-bounds addresses accessed that for several years showed no symptoms on some 20 installations.
(+) Of course, we didn't know about the RTC issue for all that time prior, it had never been observed or noticed.
Risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!