Cody

# Problem 43666. Use a timetable to analyze a train timetable (Part 3)

Solution 1476343

Submitted on 1 Apr 2018 by J. S. Kowontan
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
DepTime = datetime(2016,11,[1;1;1;1;1;1;2;2;2;2;3;3;3;3;3],... [6;7;7;8;8;9;4;6;8;3;10;5;8;4;2],[22;27;39;43;46;17;41;40;10;8;30;58;21;36;14],0); ArrTime = datetime(2016,11,[1;1;1;1;1;1;2;2;2;2;3;3;3;3;3],... [9;10;10;13;11;12;7;9;11;6;13;8;11;7;5],[17;32;09;03;26;46;13;20;19;28;40;38;27;32;24],0); Destination = categorical([1;2;1;1;1;1;2;1;3;2;1;3;3;1;2],1:3,{'BOS';'NYC';'DC'}); tt = timetable(DepTime,Destination,ArrTime); y = 5; assert(isequal(myFun(tt),y))

[Warning: Successfully read the date/time text using the format 'MM/dd/uuuu', but their format is ambiguous and could also be 'dd/MM/uuuu'. Specify a format character vector to avoid ambiguity.] [> In guessFormat (line 66) In datetime (line 612) In matlab.internal.datetime.text2timetype (line 72) In matlab.internal.datetime.text2timetype (line 24) In timerange (line 99) In myFun (line 2) In ScoringEngineTestPoint1 (line 8) In solutionTest (line 3)] [Warning: Successfully read the date/time text using the format 'MM/dd/uuuu', but their format is ambiguous and could also be 'dd/MM/uuuu'. Specify a format character vector to avoid ambiguity.] [> In guessFormat (line 66) In datetime (line 612) In matlab.internal.datetime.text2timetype (line 70) In timerange (line 99) In myFun (line 2) In ScoringEngineTestPoint1 (line 8) In solutionTest (line 3)] [Warning: Successfully read the date/time text using the format 'MM/dd/uuuu', but their format is ambiguous and could also be 'dd/MM/uuuu'. Specify a format character vector to avoid ambiguity.] [> In guessFormat (line 66) In datetime (line 612) In matlab.internal.datetime.text2timetype (line 70) In timerange (line 104) In myFun (line 2) In ScoringEngineTestPoint1 (line 8) In solutionTest (line 3)]

2   Pass
DepTime = datetime(2016,11,[2;1;1;3],[4;10;7;1],[12;53;32;42],0); ArrTime = DepTime + hours(3); Destination = categorical({'DC';'BOS';'BOS';'BOS'}); tt = timetable(DepTime,Destination,ArrTime); y = 2; assert(isequal(myFun(tt),y))

[Warning: Successfully read the date/time text using the format 'MM/dd/uuuu', but their format is ambiguous and could also be 'dd/MM/uuuu'. Specify a format character vector to avoid ambiguity.] [> In guessFormat (line 66) In datetime (line 612) In matlab.internal.datetime.text2timetype (line 72) In matlab.internal.datetime.text2timetype (line 24) In timerange (line 99) In myFun (line 2) In ScoringEngineTestPoint2 (line 6) In solutionTest (line 5)] [Warning: Successfully read the date/time text using the format 'MM/dd/uuuu', but their format is ambiguous and could also be 'dd/MM/uuuu'. Specify a format character vector to avoid ambiguity.] [> In guessFormat (line 66) In datetime (line 612) In matlab.internal.datetime.text2timetype (line 70) In timerange (line 99) In myFun (line 2) In ScoringEngineTestPoint2 (line 6) In solutionTest (line 5)] [Warning: Successfully read the date/time text using the format 'MM/dd/uuuu', but their format is ambiguous and could also be 'dd/MM/uuuu'. Specify a format character vector to avoid ambiguity.] [> In guessFormat (line 66) In datetime (line 612) In matlab.internal.datetime.text2timetype (line 70) In timerange (line 104) In myFun (line 2) In ScoringEngineTestPoint2 (line 6) In solutionTest (line 5)]

### Community Treasure Hunt

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

Start Hunting!