Locate entire word in cell given a specific pattern

1 次查看(过去 30 天)
I am trying to locate an entire word in a cell, given a specific pattern.
I am giving the following example:
stringList = {'cell', 'bell', 'charm', 'eva'}
index = find(strcmp(strList, 'ell'))
The words 'bell' and 'cell' must be located.

采纳的回答

Birdman
Birdman 2018-1-22
regexp(strjoin(stringList),'[ell]')
  2 个评论
Birdman
Birdman 2018-1-22
Yes sure:)
Firstly, strjoin command gathers the content of the cell array within a character array so that it becomes proper to apply some calculations on it. Then, regexp command takes the first argument as converted, second argument means that it will search the entire input whether there are characters containing ell expression or not.

请先登录,再进行评论。

更多回答(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