Question: 3. (a) Write a function lastWord (string) that returns the last word of the input string text. When calling the function, the sentence 'The last

3. (a) Write a function lastWord (string) that returns the last word of the input string text. When calling the function, the sentence 'The last word of this text is ...' should appear in the command line, with the last word automatically inserted at the place of the dots. (5 marks) (b) Amend the function, such that it also saves the output sentence 'The last word of this text is ..' in a file CandidateNumber.txt. (5 marks) Useful commands: isspace, length, sprintf, fopen, fprintf, fclose Save this function as lastWord.m
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
