ClassifyStrings - %usage relationship = classifyStrings(str1,str2 if strcmp(str1,str2 disp'Bingo%will display'Bingo if str1==str2 the

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function relationship = classifyStrings(str1,str2) %function to determine if the two strings possess any of the following %qualties, returning only the most inclusive, and output a string as %specified if any of the cases are true: % CASE: | OUTPUT: % - The two strings are exactly the same | 'Bingo!' % | % - The two strings are the same, ignoring caps | 'Really quite similar' % | % - The smaller string appears in the larger | 'Not so much' % string, disregarding case | % | % - None of the above are true, or one of the | 'Epic fail' % inputs is not a string
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: %usage: relationship = classifyStrings(str1,str2) if strcmp(str1,str2) disp('Bingo!') %will display 'Bingo!' if str1==str2, the boolean. .. %expression must be true elseif strcmpi(str1,str2) disp('Really quite similar') %will display 'Really quite similar'. .. %if str1==str2 (the function strcmpi will ignore the cases),. .. %the expression must be true elseif str disp('Not so much') else disp('Epic fail') %if any of the if, elseif statements are false,. .. %then 'Epic fail' will be displayed end end...
View Full Document

This note was uploaded on 10/21/2010 for the course CS 1371 taught by Professor Stallworth during the Spring '08 term at Georgia Institute of Technology.

Ask a homework question - tutors are online