I have previously asked this question and the last expert gave wrong answer. Can
ID: 3602785 • Letter: I
Question
I have previously asked this question and the last expert gave wrong answer. Can someone plese solve this one. It seems tricky and might need an idex to move string elements and re cationate the first element with the element that had its order reversed.
Confuse the reader? Write a function ReverseLetters that will take an input string consisting of a single word, and reverse the sequence of letters from the 2nd to the second to last position. The input string could be any length. For example: >>sout- ReverseLetters('Elephant') sout = Enahpelt > sout- ReverseLetters('dog') sout dog sout-ReverseLetters('I") sout = Your Function a save Reset MATLAB Documentation 1 function sout- ReverseLetters(sin) 3 reverseLetters-flip(sin([2:end])) s endExplanation / Answer
//ReverseLetter.m fie
function [sout] = ReverseLetters(Sin)
sout = fliplr(Sin)
-------------------------------------
//main.m
clear all; sout = ReverseLetters('Elephent')
sout = ReverseLetters('dog')
sout = ReverseLetters('I')
sout = ReverseLetters('gadag')
---------------------------------------------------
//output
sout = tnehpelE
sout = tnehpelE
sout = god
sout = god
sout = I
sout = I
sout = gadag
sout = gadag