Question: Please solve using Matlab and Masking Techniques. To receive a thumbs up do not use Conditional Statements(such as if, else, elseif, then) or Iterations (aka


Please solve using Matlab and Masking Techniques. To receive a thumbs up do not use Conditional Statements(such as if, else, elseif, then) or Iterations (aka loops).
Function Name: sweetHeart Inputs: 1. (char) A string of chars containing the first part of the broken Sweetheart message 2. (char) 1x4*N character vector of the words 'Yay' and 'Nay 3. (char) 1x4*N character vector containing potential words for the missing part of the Sweetheart message Outputs: 1. (char) The message of the fixed Sweetheart Topics: (strings and vectors), (masking), (concatenation) Background: It's Valentine's Day in elementary school, and you just got home with your prettily-crafted shoebox that's stuffed to the brim with candies from your friends and classmates. As you dump out the contents of your makeshift mailbox, you stumble across a box of your favorite festive candy: Sweethearts! Eager to see what messages are printed on the cute little treats, you rip open the box and pour out all of the Sweethearts onto your wooden floor, but you realize a second too late that you were too rough with the candies when they break into smithereens upon hitting the floor! You pick up a few pieces and attempt to put them back together, but no matter how hard you try, you just can't find a perfect match between any of the pieces that makes grammatical sense. Disheartened by this catastrophe, you turn to your trusty and loyal valentine, MATLAB, to piece together the mystery of what messages were written on the Sweethearts. Function Description: Given the inputs described above, write a function that performs the following operations: First, find all positions of the word 'Yay' in the second input. The words in the second input will always be 'Yay' and 'Nay' in this format. Next, using the positions found in the previous step, find the corresponding words in the third input. If 'Yay' shows up as the second word in input 2, then the corresponding word will be the second full word in input 3 (not the second index of input 3). All words in the third input will be 3 chars long, and there will be a space after each word, including the last one. Finally, concatenate the first input with the words found in step 2 to output the full message of the fixed Sweetheart. Remember to put a space between the first input and the words found in step 2 in your final output, and make sure that the end of your fixed Sweetheart doesn't have an empty space! Example: brokenMessage "BE' str 'Yay Nay Nay Nay Nay Nay Nay Yay = words = 'MIN HEY THE RE! HRU DOI NG? EK3 [fixedMessage] = sweetHeart (brokenMessage, str, fixedMessage "BE MIN E
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
