Question: MATLAB Are the letters consecutive? Write a Boolean function isConsecutive that looks at a string and then determine if the letters are occurring consecutively in
MATLAB
Are the letters consecutive?
Write a Boolean function isConsecutive that looks at a string and then determine if the letters are occurring consecutively in the string. The function also determine the number of characters in the string, and the number of letters. Restrictions: The function should use the internal function isletter. The input string could be any length. Hint: This problem can use the break statement. For example:
>> string='123', [consecutiveLetters, numberCharacters, numberLetters] = isConsecutive(string)
string =
'123'
consecutiveLetters =
logical
0
numberCharacters =
3
numberLetters =
0
>> string='Josh2a', [consecutiveLetters, numberCharacters, numberLetters] = isConsecutive(string)
string =
'Josh2a'
consecutiveLetters =
logical
1
numberCharacters =
6
numberLetters =
5
>> string='3rd.', [consecutiveLetters, numberCharacters, numberLetters] = isConsecutive(string)
string =
'3rd.'
consecutiveLetters =
logical
1
numberCharacters =
4
numberLetters =
2

1 function [consecutiveLetters, numberCharacters, numberLetters] isConsecutive(string) % Your code goes here % 4 5 end Code to call your function C Reset 1 string= '123'; [consecutiveLetters, numberCharacters, numberLettersj isConsecutive (string) - Run Function Assessment Submit Is isletter used? Are the correct answers generated? Does it work with an apostrophe in string
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
