Homework 02-Vectors, Strings, and Masking Function Name: forecast Inputs 1. (char) A character vector of the current fo...
Homework 02-Vectors, Strings, and Masking Function Name: forecast Inputs 1. (char) A character vector of the current forecast 2. (char) The word to be replaced 3. (char) The new word to put into the forecast Outputs 1. (char) The updated forecast description Banned Functions strrep), replace), regexprep() Background You have recently started your internship as a weather engineer at the local news station. Unhappy with how the curment forecasts are described as 'gloomy" and 'cold, you decide to use MATLAB to re place these words with some happier words! Function Description: Write a function that takes an input string, a word to be replaced, and the word to replace it with. Your function should output the original string, but with the one word corrected to the new word Example [out] forecast( This snowy weather is so cold., cold, awesome') outThis snowy weather is so awesome. Notes: The word to be replaced is guaranteed to appear in the forecast string, but only once Hints: strfind) will be useful in solving this problem.
Homework 02-Vectors, Strings, and Masking Function Name: forecast Inputs 1. (char) A character vector of the current forecast 2. (char) The word to be replaced 3. (char) The new word to put into the forecast Outputs 1. (char) The updated forecast description Banned Functions strrep), replace), regexprep() Background You have recently started your internship as a weather engineer at the local news station. Unhappy with how the curment forecasts are described as 'gloomy" and 'cold, you decide to use MATLAB to re place these words with some happier words! Function Description: Write a function that takes an input string, a word to be replaced, and the word to replace it with. Your function should output the original string, but with the one word corrected to the new word Example [out] forecast( This snowy weather is so cold., cold, awesome') outThis snowy weather is so awesome. Notes: The word to be replaced is guaranteed to appear in the forecast string, but only once Hints: strfind) will be useful in solving this problem.