Matlab Function Name: 3Marks The Spot 1. (chan An NxM character aray representing a map 2. (cha) A 1N character vector representing a series of directions Outputs: 1. (cha) A string representing the result and the path you take You and your friends stumble upon an ancient treasure map one day and decide to embark on an adventure. Even though you tell them you'l meet up tomomow to look for t together, you grow suspicious that they are trying to claim the tre asure for themselves! As a CS 1371 student you decide to use your MATLAB skils to try to find it before your friends do Function Description: Write a function that navigates through a character aray map based on given directions Starting at the top left comer, move according to the following directions: Up Down Right Left After each direcion, make sure to record your current locaton tthe value of the character in the map), Keep going through the drections untl you reach the reasure, represented by an x.o reach the end of the directions lfyou encounter te"X. . your final outut should be in the form: I found the treasure by following the path along
but couldn't find the treasure ap MAUQEHO directions'ESSWSESEEE treasure arksTheSpot (nap, directions) treasureI found the treasure by following the path along MAELX Notes: Te instructors wil, never gude you out oftn bounds ofthe map. and . . E. and W are the only directions (no diagonals). If you encounter the "x* in your path, you should stop there because there's no point in travelling further There is no guarantee that there is a treasure in the map. Only capital X' counts as a treasure, not x (lowercase) Letters can repeat and the path can intersect with itself There may be multiple treasures, but always stop at the first one