Question
MATLAB You may have heard of Pig Latin, where the consonants that start a word are moved to the end and followed with ay (e.g.,
MATLAB You may have heard of Pig Latin, where the consonants that start a word are moved to the end and followed with ay (e.g., plant becomes antplay). There are many such transformations that you can do with words. Lets have some fun with patients names. After each transformation, ensure that the first letter of the word is still the only letter in the word that is capitalized. Your results should all be cell arrays of character vectors, of the same size as LastName (100 by 1).
-
Italians have the farfallino alphabet, in which you add the letter f after each vowel and then add that same vowel. Convert the names in the LastName variable in the patients data set to farfallino, naming the resulting variable LafastNafamefe. (1.5 points) The first three names in LafastNafamefe should be Smifith, Jofohnsofon, and Wifillifiafams.
-
The 1970s PBS kids show Zoom introduced Ubbi Dubbi, in which you add ub before each vowel. Convert the names in LafastNafamefe to Ubbi Dubbi, naming the resulting variable LubafubastNubafubamubefube (1 point). The first three names in LubafubastNubafubamubefube should be Smubifubith, Jubofubohnsubofubon, and Wubifubillubifubiubafubams.
-
Lastly, although etymologists argue about the origin of the phenomenon, American rapper Snoop Dogg popularized replacing the last syllable of words or phrases with izzle. Apply this transformation to the names in LubafubastNubafubamubefube, naming the resulting variable LubafubastNubafubamubefubizzle. Specifically, the final vowel and all consonants which follow it should be replaced with izzle. The first three names in LubafubastNubafubamubefubizzle should be Smubifubizzle, Jubofubohnsubofubizzle, and Wubifubillubifubiubafubizzle (1 point).
-
and the result will be the same letter but in upper-case. Likewise, you can add 32 to convert upper-case letters to lower-case. If you can find built-in MATLAB functions to help you with these problems, you are welcome to use them, but it is not required or expected to do so.
ANOTHER HINT: Use square braces to add letters to a word; for example, to add x='lvi' after the 2nd letter of y='Can', you can write [y(1:2) x y(3)].
HINT: Remember that character arrays in MATLAB are stored internally as arrays of numbers. This means that you can use indexing to rearrange the letters in a character array, e.g. x=[x(end),x(1:(end-1))]. This also makes it easier to convert upper- case letters to lower-case letters and vice versa. Specifically, if you have a single character, say
x='s' thats in lower case, you can subtract 32 and convert to character:
char(x-32)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started