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

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

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!