Indexing different time stamps for same day?
이전 댓글 표시
Hi, I have a table with flight data and i converted the table called 'Manual' to timetable called TT. I would like to extract timesteps of the the data based on timerange indexing . I am confused how to execute the code. The problem is i dont know how to apply all logical indexing to the table TT.I have written 11 logical indexing variables and would like to apply all of them to the Table. As soon as apply t1 , the other logical indexing variables would be useless as the data would be gone from the TT. I am not sure if my approach is correct, what other approaches i can use to filter out the values.
TT=table2timetable(Manual)
t1=timerange('07/24/2021 08:10', '24/07/2021 08:19:30')
t2=timerange('07/24/2021 08:34', '24/07/2021 08:44:30')
t3=timerange('07/24/2021 08:52', '24/07/2021 09:03:30')
t4=timerange('07/24/2021 09:10', '24/07/2021 09:22:00')
t5=timerange('07/24/2021 09:29', '24/07/2021 09:41:00')
t6=timerange('07/24/2021 09:47', '24/07/2021 09:53:30')
t7=timerange('07/24/2021 09:59', '24/07/2021 10:00:00')
t8=timerange('07/24/2021 10:10', '24/07/2021 10:20:00')
t9=timerange('07/24/2021 10:26', '24/07/2021 10:37:30')
t10=timerange('07/24/2021 10:43:30', '24/07/2021 10:56:00')
t11=timerange('07/24/2021 11:01', '24/07/2021 11:11:30')
TT2=TT(t1,:)
채택된 답변
추가 답변 (1개)
Peter Perkins
2023년 4월 5일
편집: Peter Perkins
2023년 4월 5일
0 개 추천
Arun, as Jack implies, timerange (the class) currently can only represent one interval. You can do one of two things:
1) As Jack suggests, create an explicit logical row index using relational and logical operations on TT.Time ("Time" may have some other name in your case, not sure). That's what time range does behind the scenes.
2) Create all 11 timerange's, use them separately, then vertcat the results:
TT2 = [TT(t1,:); TT(t2,:); ...; TT(t11,:)]
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!