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.
댓글 수: 0
채택된 답변
Birdman
2018년 1월 22일
regexp(strjoin(stringList),'[ell]')
댓글 수: 2
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 Exchange에서 Characters and Strings에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!