From 7b265824d14f64d4248e3bca314b0a5f475f556f Mon Sep 17 00:00:00 2001 From: vand <vand@dtu.dk> Date: Thu, 10 Jun 2021 19:31:07 +0000 Subject: [PATCH] Upload New File --- module2_functions.m | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 module2_functions.m diff --git a/module2_functions.m b/module2_functions.m new file mode 100644 index 0000000..0819df0 --- /dev/null +++ b/module2_functions.m @@ -0,0 +1,20 @@ +hours = 5; +minutes = 15; +converted = convert_time(hours,minutes); +disp(converted) + + +% Instead of writing function from scratch, you should first implement the +% functionality, as in the code below. +minutes_in_hour = 60; +mnt = minutes/minutes_in_hour; +total = hours + mnt; + +% Then, you can pack it in the function. + +function total = convert_time(hours,minutes) +minutes_in_hour = 60; +mnt = minutes/minutes_in_hour; +total = hours + mnt; +end + -- GitLab