Borrar filtros
Borrar filtros

How to find two continuous words appear in the sentence

1 visualización (últimos 30 días)
Jothi
Jothi el 22 de Dic. de 2014
Editada: Stephen23 el 22 de Dic. de 2014
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.

Respuesta aceptada

Stephen23
Stephen23 el 22 de Dic. de 2014
Editada: Stephen23 el 22 de Dic. de 2014
Use strfind .
For example, like this:
find(~cellfun('isempty',strfind(A,'is good')))

Más respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 22 de Dic. de 2014
idx=find(~cellfun(@isempty,regexp(A,'is good','match')))

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by