compareTwo - % Otherwise, it should return false. %...

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

View Full Document Right Arrow Icon
% 9/9/2009 8:52 PM % Function Name: compareTwo % Input: 1. char vector - a string that contains two words % Output: 1. logical - true/false depending on whether the two words are % the same or not % % Function Description: % The function takes one string that contains two words seperated by a % space and returns true if the two words are identical (case sensitive).
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % Otherwise, it should return false. % function ret = compareTwo(str) str1 = str(1:find(str == ' ', 1)-1); % splits the str into 2 words str2 = str(find(str == ' ', 1)+1:end); ret = strcmp(str1, str2); % compares the words that were split from str...
View Full Document

Ask a homework question - tutors are online