Question: Please use MATLAB not using if, while, some advanced way Function Name: unscrambledEggs Inputs: 1. (double) 1XN vector of the order in which to unscramble
Please use MATLAB
not using if, while, some advanced way
Function Name: unscrambledEggs
Inputs: 1. (double) 1XN vector of the order in which to unscramble the recipe
2. (char) 1X(2N) vector representing the scrambled recipe
Outputs: 1. (char) 1X(2N) vector representing the unscrambled recipe
Topics: (LHS/RHS indexing)
Function Description: Given a character vector that represents your cookbook recipe, use the double vector to unscramble your recipe. The double vector represents a pattern that will unjumble the characters and arrange them in the correct order. However, the pattern given is only half of the length of the entire recipe. In order to successfully unjumble the recipe, you must apply the pattern to the character vector twice: once to the first half, and once to the second half. After unscrambling, output the corrected recipe.
Example: pattern = [7, 4, 1, 3, 10, 13, 12, 8, 11, 5, 9, 2, 6]
scrambled = 'w okSHMeTa oagmrEscdgb el'
unscrambled = unscrambledEggs(pattern, scrambled)
unscrambled 'How To Make Scrambled Eggs'
Notes: The character vector will always be exactly twice the length of the pattern.
The same pattern must be applied to the first and second half of the recipe.
Hints: Think about how you might split the recipe in half to make it easier to apply the pattern
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
