So far we have been assigning numeric values to all of our variables. Let's try text this time.
Your variables will now contain characters (letters, spaces, words, full sentences, etc). The way
you assign text to a variable is simply like this:
var_name = 'hello'. Notice the apostrophes on both sides of hello. This lets Matlab know that
you are assigning text to the variable var_name.
Try it with a few different words or sentences until you see how Matlab interprets them. For
words and sentences, Matlab will treat the variables as vectors in which each character in the
word or sentence is an element of the vector. Spaces count as characters.
For instance, var_name from earlier is a vector containing 5 elements [h e l l o]. So
var_name(2) will give you the 'e', or var_name(3) = 'u' will create 'heulo'.
Write a program that takes a full sentence into a variable. The program has to detect where the
spaces are and provide a list of the positions of such spaces within the sentence. Then, make
the program change every 'r' to a 'g' so we get a French accent in the input sentence. For
example: if the input sentence is 'hello how are you this morning', your program should
produce:
a) spaces are in positions 6, 10, 14, 18, 23.
b) hello how age you this mogning
Thus, the input to your program is the sentence and the outputs/results are the space positions
and the sentence with a French accent.