Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions