I have the script:
%1. Clear the memory and command window.
clearclc%2. Input a string.
string = input('What is your string: ', 's');%3. Check if the string is a palindrome or not.
if string == fliplr(string); disp (['The string, ' string ', is a palindrome.'])else disp (['The string, ' string ', is not a palindrome.'])end
I want to make it so if the user enters anything but a word for the string it does not run and maybe instead of flipping the string comparing each cell. e.g if letter 1 is the same as the last letter, if letter 2 is the same as the second last letter. This method would be prefered. Also how would i make it so that that i could enter a cell array of striings and a vector of logical values was returned.
Best Answer