varfun applied to table not recognising equal values

1 回表示 (過去 30 日間)
Phoebe Armitage
Phoebe Armitage 2020 年 12 月 10 日
コメント済み: Phoebe Armitage 2020 年 12 月 10 日
I have 3 tables with two columns of time (intervals of 10minutes) and speed. The time column is in datetime format. I have stacked the three tables on top of each other and assigned valiables a and b to the new time and speed columns, respecivetly.
Then I used:
x=varfun(@mean,TT,'GroupingVariable','Date & Time')
However the function doesn't seem to recognise Dates & Times that are equal so in x, for example, there are say two 31May2010 15:10 rows.
Oddly, After this date/time the same thing happend for every xx:10 and xx:40 time.
How do I fix this?

採用された回答

Steven Lord
Steven Lord 2020 年 12 月 10 日
Are you sure the values are equal? They could be displayed as the same value without the stored value being the same.
dt1 = datetime('now')
dt1 = datetime
10-Dec-2020 19:46:58
dt2 = dt1 + seconds(0.001)
dt2 = datetime
10-Dec-2020 19:46:58
dt1 == dt2 % false
ans = logical
0
dt2 - dt1
ans = duration
00:00:00
seconds(dt2-dt1)
ans = 1.0000e-03
  1 件のコメント
Phoebe Armitage
Phoebe Armitage 2020 年 12 月 10 日
I have a rounding error, thank you!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by