finding parent words using strfind

1 次查看(过去 30 天)
As in normal case, i will have this huge cell array of words,
wordbank={'back'; 'beast';''fairytale';'aerial';'whale';'astronomy'.......}
I asked the user for a string of letters that might compare with what I have in the wordbank, so I tried to use strfind.
say,
wchoice=input('please enter a valid parent word','s')
then from here I tried to compare which word have similarities from the input with the list of words in wordbank.
so I used strfind(wordbank,wchoice)
which later will give me the cell with indices where the words are similar instead of just displaying what the word is.
I was hoping that something like this can appear if
wchoice='al'
I typed strfind(wordbank,wchoice)
ans=
'whale'
'fairytale'
Could you help me with this?Thank you.

采纳的回答

Walter Roberson
Walter Roberson 2011-11-28
wordbank(strfind(wordbank,wchoice))
  4 个评论
Walter Roberson
Walter Roberson 2011-11-28
wordbank(~cellfun('isempty',strfind(wordbank,wchoice)))

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by