How to find the successive difference between timestamps in hours?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Devansh Patel
am 18 Jun. 2018
Kommentiert: Devansh Patel
am 19 Jun. 2018
The attachment has 1138 samples of datenum format.I want to find the sum of total hours in this order of index (2-1)+(4-3)+(6-5)+.....+(1138-1137). Any suggestions. The answer comes around 200 hours.
0 Kommentare
Akzeptierte Antwort
Guillaume
am 18 Jun. 2018
d = datetime(yourdatenumvector, 'ConvertFrom', 'datenum'); %convert to the more useful datetime
sum(hours(d(2:2:end) - d(1:2:end)))
3 Kommentare
Guillaume
am 18 Jun. 2018
In R2013a, it could possibly be calculated with:
sum(yourdatenumvector(2:2:end) - yourdatenumvector(1:2:end)) * 24
No guarantee that it works correctly. 2013a is ancient now.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Dates and Time finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!