Cody

# Problem 43667. Use a timetable to analyze a train timetable (Part 4)

Solution 2855210

Submitted on 20 Aug 2020 by Philip Butcher
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); Dur = [duration(3,9,05);duration(2,55,15);duration(3,0,24)]; ttDur = myFun(tt); assert(all(abs(ttDur - Dur) <= 0.01))

tt = 15x3 timetable <strong>DepTime</strong> <strong>Destination</strong> <strong>ArrTime</strong> <strong>JourneyTime</strong> <strong>____________________</strong> <strong>___________</strong> <strong>____________________</strong> <strong>___________</strong> <strong>01-Nov-2016 06:22:00</strong> BOS 01-Nov-2016 09:17:00 02:55:00 <strong>01-Nov-2016 07:27:00</strong> NYC 01-Nov-2016 10:32:00 03:05:00 <strong>01-Nov-2016 07:39:00</strong> BOS 01-Nov-2016 10:09:00 02:30:00 <strong>01-Nov-2016 08:43:00</strong> BOS 01-Nov-2016 13:03:00 04:20:00 <strong>01-Nov-2016 08:46:00</strong> BOS 01-Nov-2016 11:26:00 02:40:00 <strong>01-Nov-2016 09:17:00</strong> BOS 01-Nov-2016 12:46:00 03:29:00 <strong>02-Nov-2016 04:41:00</strong> NYC 02-Nov-2016 07:13:00 02:32:00 <strong>02-Nov-2016 06:40:00</strong> BOS 02-Nov-2016 09:20:00 02:40:00 <strong>02-Nov-2016 08:10:00</strong> DC 02-Nov-2016 11:19:00 03:09:00 <strong>02-Nov-2016 03:08:00</strong> NYC 02-Nov-2016 06:28:00 03:20:00 <strong>03-Nov-2016 10:30:00</strong> BOS 03-Nov-2016 13:40:00 03:10:00 <strong>03-Nov-2016 05:58:00</strong> DC 03-Nov-2016 08:38:00 02:40:00 <strong>03-Nov-2016 08:21:00</strong> DC 03-Nov-2016 11:27:00 03:06:00 <strong>03-Nov-2016 04:36:00</strong> BOS 03-Nov-2016 07:32:00 02:56:00 <strong>03-Nov-2016 02:14:00</strong> NYC 03-Nov-2016 05:24:00 03:10:00

### Community Treasure Hunt

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

Start Hunting!