Question: Matlab In this problem, you will write two functions. The first function takes in a string and returns that string without any dashes. The second

Matlab

Matlab In this problem, you will write two functions. The first functiontakes in a string and returns that string without any dashes. Thesecond function takes in the first and last name and returns a

In this problem, you will write two functions. The first function takes in a string and returns that string without any dashes. The second function takes in the first and last name and returns a string that is lastname firstname and uses the previous function to remove any dashes (-) in the name. - Note that you'll be testing it by calling it from the command line; you'll call it from a script in problem 3. Deliverables: 1. Function file that takes in a string and returns a string without a dash a. A script is not necessary for this problem 2. Call that function from the command line and show that it works a. strNoDash-BemoveDasbl'first-name); i. For this problem, you will not need to create a script to show your function works. 3. Function file that takes in first and last name and returns the joined name a. This should include the BemoveDash function ran for both the first and last name 4. Call the function from the command line and show that it works a. str loinName'first', "last') > b. st=loinName(first,'last-name);, c. str-loinNamefirst-name, 'last-name); Step by Step Instructions: Create a function file that takes in a string and returns the same string with no dashes. - Add code to your function to check for the dash (-) in either the first or last name- . Try strfind(first'). What do you get? try strfindl'first-dash'). What do you get? - o You'll need to check for an empty return o o If you have a dash, you need to delete it. There's two ways tstro do this. Either set that element to the empty array o array(k) -1 - deletes the kth elemeht from array o array-strcat(array(1:k-1), array (k+1:end)-set the array to the first and second halves . The inputs should be the first and last names as strings with 'first and 'last' (call from the command line) > Create another function file. It should take in two variables and return one. > Start with using strcat or sprintf to ioin the names together. Check that it works Note: One trick is to copy the first line of the function file, delete the function key word, and then put your own variable values in. This makes sure that you have the inputs and the outputs in the right order> o o .e., copy function functignlstrQut] JoinNamesl strEirst, strlast) to the command line, o And then edit to be strQut- Join Names'first', 'last') Make sure to implement the RemoveDash function for both names in the JoinNames function 3 o Call this on both inputs from within your join string function Self-check: . staiaame'first','last) Sst 5 > sta-oinNaneL'first-dash', 'last') > sta-oinNaneL'first-dash', 'last-dash

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!