Question: Matlab Make a function, called hmwk5.m, to convert the month from a number to a string. It should have one input, an integer value, that

Matlab

Make a function, called "hmwk5.m", to convert the month from a number to a string. It should have one input, an integer value, that specifies the month, i.e. 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, or 12. It should return one output, a string, i.e. January, February, March, April, ..., or December. Use a "switch" statement to choose the output string. Note that the function should normally not print anything, unless the input is a value not listed above. In that case, it should print a message using the "error" command.

Like earlier assignments, use the "type" command and several test cases to show that your function works. Turn in a copy of the interaction, i.e. copy from the MATLAB command window, or use the diary command.

Example: >> monthname = hmwk5(1); >> disp(sprintf(' The month is %s.', monthname)); The month is January.

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!