Question: Code for confuse the reader: function sout= ReverseLetters(sin) sout = ''; if length(sin) == 1 sout(end + 1) = sin(1); else sout(end+1) = sin(1); for

Code for confuse the reader: function sout= ReverseLetters(sin) sout = ''; iflength(sin) == 1 sout(end + 1) = sin(1); else sout(end+1) = sin(1);for i = 1:length(sin)-2 if i % 2 == 0 sout(end +Code for confuse the reader:

function sout= ReverseLetters(sin) sout = ''; if length(sin) == 1 sout(end + 1) = sin(1); else sout(end+1) = sin(1); for i = 1:length(sin)-2 if i % 2 == 0 sout(end + 1)= sin(length(sin) - i); else sout(end + 1) = sin(i); end end sout(end+1) = sin(end); end end

code for how many consecutive ones :

function [indicator,startPositionOfAllOnes,endPositionOfAllOnes,lengthofAllOnes] = FindConsecutiveOnes(inputArray)

indicator = zeros(1, length(inputArray));

j = 1;

for i = 1 : length(inputArray)

if i == 1 && inputArray(i) == 1

startPositionOfAllOnes(j) = i;

elseif inputArray(i) == 1 && inputArray(i-1) == 0

startPositionOfAllOnes(j) = i;

elseif i ~= 1 && inputArray(i) == 0 && inputArray(i-1) == 1

endPositionOfAllOnes(j) = i-1;

lengthOfOnes(j) = endPositionOfAllOnes(j) - startPositionOfAllOnes(j) + 1;

j = j + 1;

end

end

if inputArray(length(inputArray)) == 1

endPositionOfAllOnes(j) = length(inputArray);

lengthOfOnes(j) = endPositionOfAllOnes(j) - startPositionOfAllOnes(j) + 1;

end

for j = 1 : length(lengthOfOnes)

indicator(startPositionOfAllOnes(j)) = lengthOfOnes(j);

end

end

LAB 23.44.1: It dseon't mettar waht oedrr the Irettes in a wrod are. (Strings) Part 3 This tool is provided by a third party. Your act ACTIVITY (final) of larger project Alfa always recorded, but you may need to refresh the page to fill in the banner. 15 It dseon't mettar waht oedrr the Irettes in a wrod are. Write a function ScrambleLetters to take a phrase consisting of letters and non-letters, identify all the letters and then for all consecutive letters reverse the subsequence of the letters as was descibed in the previous assignment "Confuse the reader?". The input phrase could be any length. The input sentence and output phrase whould be a character array. As subfunctions the function ScrambleLetters should use the functions FindConsecutiveOnes and ReverseLetters written in the previous assignments "How many consecutive ones?" and "Confuse the reader?" Restriction: The function ScrambleLetters must use the custom functions FindConsecutiveOnes and ReverseLetters written in written in the previous assignments "How many consecutive ones?" and "Confuse the reader?", respectively. Your function can simply call the function FindConsecutiveOnes and ReverseLetters For example: >>inputString='Ones and 1 is sometimes two'; >> [outputSt ring] = ScrambleLetters( inputString) outputstring = Oens and 1 is semitemos two LAB 23.44.1: It dseon't mettar waht oedrr the Irettes in a wrod are. (Strings) Part 3 This tool is provided by a third party. Your act ACTIVITY (final) of larger project Alfa always recorded, but you may need to refresh the page to fill in the banner. 15 It dseon't mettar waht oedrr the Irettes in a wrod are. Write a function ScrambleLetters to take a phrase consisting of letters and non-letters, identify all the letters and then for all consecutive letters reverse the subsequence of the letters as was descibed in the previous assignment "Confuse the reader?". The input phrase could be any length. The input sentence and output phrase whould be a character array. As subfunctions the function ScrambleLetters should use the functions FindConsecutiveOnes and ReverseLetters written in the previous assignments "How many consecutive ones?" and "Confuse the reader?" Restriction: The function ScrambleLetters must use the custom functions FindConsecutiveOnes and ReverseLetters written in written in the previous assignments "How many consecutive ones?" and "Confuse the reader?", respectively. Your function can simply call the function FindConsecutiveOnes and ReverseLetters For example: >>inputString='Ones and 1 is sometimes two'; >> [outputSt ring] = ScrambleLetters( inputString) outputstring = Oens and 1 is semitemos two

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!