Problem 43664. Use a timetable to analyze a train timetable (Part 1)
Oh no, you missed your train to Boston! Find the departure time of the next available train by analyzing the train timetable. The trip should not take longer than 5 hours.
Example:
DepTime = datetime(2016,11,1,[6 8 9],[22 51 05],0)';
ArrTime = datetime(2016,11,1,[9 10 12],[17 32 09],0)';
Destination = categorical({'BOS';'NYC';'BOS'});
tt = timetable(DepTime,Destination,ArrTime)
tt =
DepTime Destination ArrTime
____________________ ___________ ____________________
01-Nov-2016 06:22:00 BOS 01-Nov-2016 09:17:00
01-Nov-2016 08:51:00 NYC 01-Nov-2016 10:32:00
01-Nov-2016 09:05:00 BOS 01-Nov-2016 12:09:00
Feature Tip: R2016b introduces timetables with related functions which may be helpful. To learn more see MATLAB Timetables.
Related Problems:
Use a timetable to analyze a train timetable (Part 1)
Solution Stats
Problem Comments
-
3 Comments
Rafael S.T. Vieira
on 30 Aug 2020
This problem needs more test cases, and probably the current time should be added. Or it should be declared that the timetable does not contain past trips.
Jean-Marie Sainthillier
on 8 Jul 2022
I notice that several problem groups have duplicates.
For example "R2016b Feature Challenge" with Use a timetable series, or "Strings III" with Cat, Meowcat and Concatenation or longest common semi-substring problems.
Robert
on 29 Oct 2022
Train timetables in the test suite for this problem are odd. Some train departure times on same day to the same destination are not in chronological order.
Solution Comments
Show commentsProblem Recent Solvers27
Suggested Problems
-
4467 Solvers
-
1629 Solvers
-
Back to basics 21 - Matrix replicating
1533 Solvers
-
149 Solvers
-
10509 Solvers
More from this Author4
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!