Compare first letter of strings in Matlab -
i see if letter inputted user matches of words in dictionary.
could please me this? thank you!
words = {'apple', 'banana', 'bee', 'salad', 'corn', 'elephant', 'pterodactyl'}; user_letter_input = input('please enter first letter of word: '); = words if (i starts user_letter_input) disp(['your new word is: ' i]); end end
you can use:
if(i{1}(1) == user_letter_input)
Comments
Post a Comment