Question: matlab Write a function called SwitchNames that switches the first name and surname of the entries in a string array. The input is an n
matlab
Write a function called SwitchNames that switches the first name and surname of the entries in a string array. The input is an n x string array, with each array entry consisting of a first name and a surname placed in a string scalar. The function switches the first name and surname, and inserts a comma and space between the surname and the first name.
Restriction: The function must use the internal functions split and join.
Ex:
listOfNameSurnames Barney Google";"Snuffy Smith";"Dagwood Bumstead"
listOfNameSurnames
times string array
"Barney Google"
"Snuffy Smith"
"Dagwood Bumstead"
OutputStringsArray SwitchNameslistOfNameSurnames
OutputStringsArray
times string array
"Google, Barney"
"Smith, Snuffy"
"Bumstead, Dagwood"
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
