How to check if my time series has a repeated hour in a matrix of 10200 rows?

2 views (last 30 days)
Hello, I have this time series matrix from 01/01/2019 to 29/02/2020, hourly. I would like to know if in some part of the matrix the hour or the day, is repeated with respect to the previous row? I appreciate if anyone knows how I can find that, Thank you.
Var 1 yy mm dd hh min
737426 2019 1 1 0 0
737426.041666667 2019 1 1 1 0
737426.083333333 2019 1 1 2 0
737426.125000000 2019 1 1 3 0
737426.166666667 2019 1 1 4 0
737426.208333333 2019 1 1 5 0
737426.250000000 2019 1 1 6 0
737426.291666667 2019 1 1 7 0
737426.333333333 2019 1 1 8 0
737426.375000000 2019 1 1 9 0
737426.416666667 2019 1 1 10 0
737426.458333333 2019 1 1 11 0
737426.500000000 2019 1 1 12 0
737426.541666667 2019 1 1 13 0
737426.583333333 2019 1 1 14 0
737426.625000000 2019 1 1 15 0
737426.666666667 2019 1 1 16 0
737426.708333333 2019 1 1 17 0
737426.750000000 2019 1 1 18 0
737426.791666667 2019 1 1 19 0
737426.833333333 2019 1 1 20 0
737426.875000000 2019 1 1 21 0
737426.916666667 2019 1 1 22 0
737426.958333333 2019 1 1 23 0
737427 2019 1 2 0 0
737427.041666667 2019 1 2 1 0
737427.083333333 2019 1 2 2 0
... Until February 2020

Accepted Answer

jonas
jonas on 28 Jul 2020
Convert everything to datetime and then check the difference
%some data, note that 2000-1-1 10:00:00 is repeated
t = datetime(2000,1,1,[0:10,10:100],0,0);
%find instances where the difference is smaller than 1h
id = find(diff(t) < hours(1))
id =
11
  1 Comment
Fabian Moreno
Fabian Moreno on 29 Jul 2020
thank you jonas, just to know, I use this one "id = find(diff(t) < hours(1))" abd worked pretty good, but instead of hours, there is another form to use to days or months, I did it with days and didn't work. Thank you

Sign in to comment.

More Answers (0)

Categories

Find more on Dates and Time in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!