In MatLab, write a function called RemoveNStates that removes all the U.S. states…
Jump to turn (7)
- 1In MatLab, write a function called RemoveNStates that removes all the U.S. state
- 2Write a function called CleanUp to tidy up a sentence and produce a string scala
- 3Write a function called SwitchNames that switches the first name and surname of
- 4Write a function called SeussifyString to replace each occurrence of the substri
- 5Write a function called CheckInputs which checks if three input parameters are t
- 6Example : >> name="Joe"; gpa=3; enrollStatus=true; % All datatypes correct error
- 7CheckInputs("Joe", 1, true) need to return errorCode=[0 0 0 0]
- User
In MatLab, write a function called RemoveNStates that removes all the U.S. states beginning with the letter N. The states are given as a string array. The states beginning with the letter N present in the sentence should removed from the scalar array. All state names are assumbed to be spelled exactly as given in U.S. states.
Restrictions: The function RemoveNStates should not use loops. RemoveNStates should use the functions split, erase, strtrim and join.
Hint: First, the states starting with N should be removed from the string arrays, resulting in some string scalar entries that are empty. Then empty entries should be removed from the scalar array. Ex:s1 = ["New York"; "Alabama"; "Montana"; "Nebraska"; "Vermont"; "Nevada"]; reducedList = RemoveNStates(s1) reducedList = "Alabama" "Montana" "Vermont"
Use this code:
function sout = RemoveNStates(s1) d=["Nebraska", "Nevada","North Carolina","New Jersey","New York","New Mexico","New Hampshire"];
code% Your solution goes here %end
- Assistant