(Solved) : Inputs Char Sentence Modified Char Word Replaced Sentence Char Word Replace Outputs 1 Char Q44095286 . . .
Inputs:
-
(char) A sentence to be modified
-
(char) The word to be replaced in the sentence
-
(char) The word to replace with
Outputs:
1. (char) Modified sentence Banned Functions:
strrep()
Background:
The ctrlF and replace feature on your laptop is broken and youneed to use MATLAB to do the job!
Function Description:
Your function will replace one word within your sentence withanother, indicated by your input variables. Your output will be theentire modified sentence with the replaced word.
Example:
original = ‘My favorite class is physics!’; wordFind =’physics’;
wordReplace = ‘CS1371’;
out = repWord(original, wordFind, wordReplace); out → ‘My favoriteclass is CS1371!’
Notes:
-
● There will be exactly one instance of the word you willreplace (it will not appear twice in a sentence)
-
● Your function should be case sensitive (i.e. ’MATLAB’ and’matlab’ are not the same)
Hints:
-
● The strfind() function will be useful!
Expert Answer
Answer to Inputs: (char) A sentence to be modified (char) The word to be replaced in the sentence (char) The wor…
OR