Selection of data in timetable

7 ビュー (過去 30 日間)
Enrique Escrig
Enrique Escrig 2020 年 6 月 6 日
回答済み: J. Alex Lee 2020 年 6 月 7 日
Hi! I have a file in .mat format. This file contais mesurement every 15 min ouver a year. For my analysis, i need to choose only the measurements from 9:00 to 14:00 of each day. Created an example variable of how I have it.
TT = rand(35136,1);
TT = table(TT);
TT = table2timetable(TT,'TimeStep',calendarDuration(0,0,0,0,15,0),"StartTime",datetime(2012,1,1));
I hope your help and I thank you in advance.

回答 (1 件)

J. Alex Lee
J. Alex Lee 2020 年 6 月 7 日
Hmm, so the question is about periodic time ranges...there might be a better way, but maybe you can use "isbetween" on an auxiliary table column that holds the "time" part of your datetime as a duration type...you can extract the "time" part by subtracting the date part of the datetime from the datetime using "dateshift":
TT.TimeOfDay = TT.Time - dateshift(TT.Time,"start","day");
mask = isbetween(TT.TimeOfDay,duration(9,0,0),duration(14,0,0))
Sorry I haven't tested this though, it should be quick to try.

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by