Question: Banned Functions: if, while PLEASE use MATLAB PLEASE read instruction Function Name: mealPrep() Inputs: 1. (char) A 1 x N char vector containing a message
Banned Functions: if, while
PLEASE use MATLAB
PLEASE read instruction
Function Name: mealPrep()
Inputs: 1. (char) A 1 x N char vector containing a message
Outputs: 1. (char) a 1X N char vector of the decoded sentence
Topics: (char vectors),(LHS/ RHS indexing), (colon operator), (strfind/strrep), (casting)
Function Description: Given a character vector containing a message, follow these steps in the correct order to decipher it:
1. Starting with the first index of the char vector, shift every third index up 2 ASCII values (for example,'q' 's')
2. Replace all underscores '_' with a single space
3. Capitalize the first letter of every word in the sentence
Example: mixed = 'qalr_tfe_uatcr_`efmre]boglilg_gt'
fixed = mealPrep(mixed)
fixed 'Salt The Water Before Boiling It'
Notes: Make sure to capitalize the first letter of every word, including the first word (step 3)
Words will be separated by a single underscore
The original statement may contain special characters, but shifting should remove all special characters (except underscores), and the final output should not contain any
Hints: You may need to cast the char vector to a different data type to perform a mathematical "shift" for step 1
The letters at the beginning of a word are always one index after a space except for the very first character of the string
The colon operator may be useful
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
