Question: MATLAB Problem 4: The built-in function clock returns a row vector that contains 6 elements: the first three are the current date (year, month, day)
Problem 4: The built-in function clock returns a row vector that contains 6 elements: the first three are the current date (year, month, day) and the last three represent the current time in hours (24 hour clock), minutes, and seconds. The seconds is a real number, but all others are integers. Use function sprintf to accomplish the following formatting exercises should be the date and time when the grader calls your script DD, and YYYY corresponds to month, day, and year, respectively MM, and SS.SS corresponds to hour, minute and second, respectively HH:MM:SS. Put the answer into string p4d the answer in string p4e a) Get the current date and time and store them in p4a. The current date and time b) Using the format 'MM:DD:YYYY", write the current date to string p4b. Here, MM c) Using the format 'HH:MM:SS.SS, write the current time to string p4c. Here, HH d) Remove the last 3 digits from the string in part (c) so that the format is now e) Combine the strings in part (b) and part(d) together separated by a single space. Put
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
