MATLAB Answers

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

1 ビュー (過去 30 日間)
Fabian Moreno
Fabian Moreno 2020 年 7 月 28 日
コメント済み: Fabian Moreno 2020 年 7 月 29 日
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

  0 件のコメント

サインインしてコメントする。

採用された回答

jonas
jonas 2020 年 7 月 28 日
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 件のコメント

Fabian Moreno
Fabian Moreno 2020 年 7 月 29 日
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

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by