function x = eng2PL1(x) % function x = eng2PL1(x) % S. Scott Moor, October 2007 % This is an improved function for translating single English words into % Pig Latin. This program will recognize if the first letter is a vowel % and not move it if it is a vowel % % Input x = a single word string of at least 2 characters (no spaces) % Output x = the Pig Latin equivelent % Internal variables: % cons = a cell array of all lower-case consonants % vowel = a cell array of all lower-case vowels % make all letters lower case and set up list of vowels & consonants x=lower(x); if any(x(1)=='aeiouy') % if x starts in a vowel simply add 'ay' x = [x,'ay']; else % otherwise move leading consonant to the end of the word and add 'ay' x = [x(2:end),x(1),'ay']; end