Question: using matlab Write a script called NameSwap.m that does the following. The script should only display values if the instructions below explicitly instruct to do

using matlab

using matlab Write a script called NameSwap.m that does the following. The

Write a script called NameSwap.m that does the following. The script should only display values if the instructions below explicitly instruct to do so. 1. Stores your full name as a string in a variable called myname. The string should consist of your first and then your last name, separated by a space. If your name contains spaces, remove those spaces (for example, if your first name is Mary Jo, use Mary Jo instead). 2. Initializes an empty string called firstname as follows: firstname = ''; 3. Uses a while loop to concatenate elements of myname to the variable firstname until firstname contains your entire first name and only your first name. 4. Uses a for loop to replace every second letter in firstname with a capital G. For example, the professor's first name (Brahm) would become BGaGm. 5. Displays Your new first name is XYZ! (except, replace XYZ with the value of firstname)

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!