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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started