Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Function Name: unscrambledRecipe Inputs: 1. ( double ) 1XN vector of the order in which to unscramble the recipe 2. ( char ) 1X(2N) vector

Function Name:unscrambledRecipe

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)

Background:

You've been MATLABing all day, and man, are you hungry. You're feeling breakfast for

dinner, so you turn to your trusty cookbook to find the recipe for your favorite breakfast meal:

pancakes! But it looks like you're out of luck! Your roommate pranked you and replaced

your cookbook with another. All the words on the recipe are jumbled, but they seem to follow a

pattern. With your stomach growling, you turn to MATLAB for a quick save so you don'tdieof

hunger tonight.

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 unscramble 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 = unscrambledRecipe(pattern, scrambled)

unscrambled 'How To Make Scrambled Eggs'

Notes:

The character vector will always be exactly twice the length of the pattern.

Thesamepattern must be applied to the first and second half of the recipe.

Please solve without using Conditional Statements or Iterations for credit!!!!! Solve using Matlab!!!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions

Question

How are fewness of firms and mutual interdependence related?

Answered: 1 week ago

Question

In Exercises evaluate the definite integral. TT/3 tan x dx

Answered: 1 week ago

Question

What has been your desire for leadership in CVS Health?

Answered: 1 week ago

Question

Question 5) Let n = N and Y Answered: 1 week ago

Answered: 1 week ago