You are analyzing a train timetable (you have some time to kill since you just missed your train!) How many trains depart each day of the week? (submit the results as a table with the days of the week and number of trains)
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
The result should be given as a table:
DayOfWk = {'Thu';'Tue';'Wed'};
GroupCount = [5;6;4];
numTrains = table(DayOfWk,GroupCount)
numTrains =
DayOfWk GroupCount
_______ __________
'Thu' 5
'Tue' 6
'Wed' 4
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)
Use a timetable to analyze a train timetable (Part 2)
Use a timetable to analyze a train timetable (Part 3)
Use a timetable to analyze a train timetable (Part 4)
Use a timetable to analyze a train timetable (Part 5)
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers60
Suggested Problems
-
Determine whether a vector is monotonically increasing
22967 Solvers
-
Find the numeric mean of the prime numbers in a matrix.
9138 Solvers
-
Back to basics 17 - white space
280 Solvers
-
Piecewise linear interpolation
617 Solvers
-
Given a square and a circle, please decide whether the square covers more area.
1745 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!
Problem set provided me with an enjoyable introduction to Timetables, thank you.