Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

First, use Matlab to create another folder inside your homework folder called lastname-initial-pp05 where lastname is YOUR last name and initial is YOUR first initial.

image text in transcribed

First, use Matlab to create another folder inside your homework folder called lastname-initial-pp05 where lastname is YOUR last name and initial is YOUR first initial. Use all lower-case letters when naming your folder for this assignment. Second, download the grading script for this problem and save it to the folder you just created. Make sure you save all the m-files for this assignment to this folder as well. When you have finished the assignment, run the grading script and then use Matlab to create a .zip file of your assignment folder. Submit only this .zip file to the D2L dropbox. Write a Matlab function called backthatstringup.m which takes any string (i.e. vector of char's... a list of characters, surrounded by single quotes) and rewrites it in reverse order. You must use either a for loop or a while loop in your code and you may not use the built-in Matlab functions fliplr or flipud. The specifications for the function and some sample function calls are shown below. input parameter message a string to be reversed output parameter egassem the reversed message sample function calls backthatstringup ('This is a sentence.') produces '_ecnetnes a si sihT' backthatstringup ('12345') produces '54321' backthatstringup('racecar') produces 'racecar' Write a Matlab function called swapcode.m that takes a string txt as input and returns an-other string swaptxt as output. The function encodes the string by reversing the alphabet: it replaces each 'a' with 'z', each 'b' with 'y', each 'c' with 'x', etc. The function must work for uppercase letters the same way, but it must not change any other characters. Note that if you call the function twice like this txtout = flipcode (flipcode (txtin)) then the string stored in txtout will be identical to the string stored in txtin. The specifications for the function and some sample function calls are shown below. input parameter txt a string output parameter swaptxt a string sample function calls swapcode ('This is a sentence.') produces 'Gsrh rh z hvmgvmxv.' swapcode ('Who has a 3-legged dog?') produces 'Dsl szh z 3-ovttvw wlt?' swapcode (swapcode('Dave97')) produce 'Dave97

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 2 Lnai 9285

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Joao Gama ,Alipio Jorge ,Carlos Soares

1st Edition

3319235249, 978-3319235240

More Books

Students also viewed these Databases questions