Question: 2. function indexes-find-letter-positions( word, letter ) This function will take in a word and a specific letter. It will then return a list of all


2. function indexes-find-letter-positions( word, letter ) This function will take in a word and a specific letter. It will then return a list of all the positions in the word where that letter exists. For example, given the word happy, the character 'h' occurs at position 1. The character 'p' occurs at positions 3 and 4. The character 'z occurs at NO position (i.e.: the empty [l position). Here is an example of the function working: >> find_letter_positions ('hello, 'h') ans >> find_letter_positions('hello, '1') ans 3 4 1 >> find_letter_positions ('hello', z') ans = [ ]; % an empty array You should (from memory) copy the function design pattern into a new.m file called "find_letter_positions.m". Once you have a basic outline, in the header comments, sketch the algorithm you will use to "search" the "word" (string) for the given positions. Remember, you will also need a variable to store the
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
