Question: Adjacent Repeat of Numbers in an Array Write a function called DoubleLetterCheck ( ) that uses loops to determine if any two adjacent characters in

Adjacent Repeat of Numbers in an Array
Write a function called DoubleLetterCheck() that uses loops to determine if any two adjacent characters in a string array are the same.
The input argument is a character array called inString.
The output argument is an integer scalar called DoubleLetters. This value is set to an integer value of 1 if two character next to one
another are the same in the array. Otherwise, this value is set to 0.
Ex: Given
inString = 'chocolate chip cookie';
DoubleLetters = DoubleLetterCheck(inString)
The output is:
DoubleLetters =1
because of the two 'o' characters in 'cookie'.
Ex: Given
inString = 'chocolate fudge ice-cream';
DoubleLetters = DoubleLetterCheck(inString)
The output is:
DoubleLetters =0
No adjacent characters are the same.
Remember that MATLAB functions such as numel can be used to get the number of elements in a 1D array. One possible strategy is to
iterate from position 2 to the number of elements, and during each iteration, check each preceding element to see if a match exists.
Function o.
Code to call your function ?
1 inString = 'chocolate chip cookie';
DoubleLetters = DoubleLetterCheck(inString)
 Adjacent Repeat of Numbers in an Array Write a function called

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!