How to find two continuous words appear in the sentence

1 次查看(过去 30 天)
sir, Input cell arry
A= {' book is good','camera is working good', 'the picture quality is good'}
Query B={'is good'}
how to find index of the query string is appeared in the sentence.
my output is = 1,3
thanks.

采纳的回答

Stephen23
Stephen23 2014-12-22
编辑:Stephen23 2014-12-22
Use strfind .
For example, like this:
find(~cellfun('isempty',strfind(A,'is good')))

更多回答(1 个)

Azzi Abdelmalek
Azzi Abdelmalek 2014-12-22
idx=find(~cellfun(@isempty,regexp(A,'is good','match')))

类别

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