how to make a function
조회 수: 4 (최근 30일)
이전 댓글 표시
Muhammad Usman Saleem
2015년 5월 22일
댓글: Muhammad Usman Saleem
2015년 5월 24일
Hi everyone;
I am going to make a function that takes starting timing of two movies.like hr1,hr2,min1,min2,and their durations, durnmin1,durmin2 and decides whether we can binge and watch both movies. The criteria are that they must not overlap and that we are not going to wait more than 30 minutes between the end of one and the beginning of the next. It returns true if the criteria are both met and returns false otherwise. You may assume that movie start times are always after 1 pm and before midnight. You may also assume that the first one starts earlier. The order of the input arguments is: hr1, min1, durmin1, hr2, min2, durmin2.
I am unable to understand what will my function will do.what are these timing hr1,hr2? why duration has been given.In that function what i have to do...Thanks in advance for assistance
댓글 수: 0
채택된 답변
Walter Roberson
2015년 5월 22일
You need to add the first duration to the first start time in order to figure out when the first one ends. Then you need to figure out how much time there is between the projected end time of the first one, and the start of the second. If the second one would start before the first one is projected to end then they overlap. If the second one would start more than 30 minutes after the first one is projected to end then they are too far apart to be desired.
댓글 수: 5
Walter Roberson
2015년 5월 23일
You did not check for the case where the second one starts before the first one ends.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!