Question: Using MATLAB Homework 7-Iteration Homework 7-Iteration Function Name: XMarksTheSpot map Inputs: 1. 2. (char) An NxM character array representing a map (char)A 1xN character vector

Using MATLAB Homework 7-Iteration Homework 7-Iteration Function Name: XMarksTheSpot map Inputs: 1.Using MATLAB

Homework 7-Iteration Homework 7-Iteration Function Name: XMarksTheSpot map Inputs: 1. 2. (char) An NxM character array representing a map (char)A 1xN character vector representing a series of directions MAUQEH otqlDao aLbls Outputs: 1. (cha) A string representing the result and the path you take directions'ESSWSESEEE treasure XMarks TheSpot (nap, directions) treasureI fournd the treasure by following the path along MAtLaBX! Background: Yau and your friends stumble upon an ancient treasure map one day and decide to embark on an adventure. Even though you tell them you'll meet up tomorrow to look for it together, you grow suspicious that they are trying to claim the treasure for themselves! As a CS 1371 student, you decide to use your MATLAB skils to try to find it before your friends do! Notes: The instructions will never guide you out of the bounds of the map andNSEand Ware the only directions ino diagonals). . Function Description: Write a function that navigates through a character array map based on given directions. . If you enccunter the'X in your path, ycu shculd stop there because there's no point in Starting at the top left corner, move according to the following directions travelling further Letters can repeat and the path can intersect with itself There is no guarantee that there is a treasure in the map . There may be mutiple treasures, but always stop at the first one Only capital' curnts as a treasre, not'x' owercase) Up Down Right Left S' After each direction, make sure to record your current location (the value of the character in the map). Keep going through the directions until you reach the treasure, represented by an 'x' or reach the end of the directions If you encounter the 'x', your final output should be in the fom: I found the treasure by following the path along ! If you go through all the given directions and don't find the treasure, output: I nt along the path ! If you go through all the given directions and don't find the treasure, output: I nt along the path

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!