Question: Matlab Question Constructor function Creat a constructor function SetTimeConstruct, with integer inputs hoursVal and minutesVal,to construct a structureTimeHrMin with two fields, one is hours to

Matlab Question

Matlab Question Constructor function Creat a constructor function SetTimeConstruct, with integer inputs

Constructor function Creat a constructor function SetTimeConstruct, with integer inputs hoursVal and minutesVal,to construct a structureTimeHrMin with two fields, one is hours to hold the hours, and minutes to hold the minutes. The constructor function should check if 0 S hours 24and 0 minutes s 60. If not, set the value to 0. For example >timel-SetTimeConstruct( 23, 31) time! = struct with fields hours: 23 mins: 31 >>time2 SetTimeConstruct( 25, 31) time2 = struct with fields: hours: 0 mins: 31 >> time3 SetTimeConstruct( 25, -1) time3 = struct with fields: hours: 0 mins: e Your Function Save Reset , MATLAB Documentation 1 function tempVal SetTimeConstruct( hours, mins) % Your code goes here % 4 5 end 6

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!