フィルターのクリア

Locate entire word in cell given a specific pattern

2 ビュー (過去 30 日間)
GEORGIOS BEKAS
GEORGIOS BEKAS 2018 年 1 月 22 日
コメント済み: Birdman 2018 年 1 月 22 日
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 件のコメント
GEORGIOS BEKAS
GEORGIOS BEKAS 2018 年 1 月 22 日
can you also explain that to me? :)
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 Center および File ExchangeCharacters and Strings についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by