%this main script calls to one main function(isPalindrome) with a subfunction(removeNonAlpha) %this script prompts the user for a character vector to test for being a % palindrome fprintf('A palindrome is a word, phrase, or sequence that reads the same backward as forward\n') str=input('Enter text to test for palindrome:','s'); welp=isPalindrome; if welp==1 fprintf('Heyy!! %s is a palindrome :) ',str) else fprintf('Dang :( %s is not a palindrome ',str) end
The function that the first script calls is as follows
%this function tests whether a character vector is a palindrome function Welp=isPalindrome(~) strrevised=removeNonAlpha(str); if strrevised==fliplr(strrevised) Welp=1; else Welp=0; end end function strrevised=removeNonAlpha(str) %this function takes in a string and revises it to remove blanks and to %remove numbers ie take only alpha characters str2=isletter(str); strrevised=str(str2); end
function Welp=isPalindrome(~)
insert
str = evalin('caller', 'str');
Or
str = evalin('base', 'str');
Neither of these is recommended. Recommended would be to have used
welp=isPalindrome(str);
with
function Welp=isPalindrome(str)
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.