case insensitive strfind?

I have a matrix in which there are about 100,000 sentences that I want to scan for the existence of certain words (True/false). For previous scans, searching for one exact word, I used the strfind. Nevertheless, now I have a list of 18 words which might be written in lower or upper cases in the sequences. The strcmpi which could be useful in this case only returns positive if the whole sentence consist of the word... Is there another function I missed?
Thank you

 Respuesta aceptada

Titus Edelhofer
Titus Edelhofer el 24 de Jul. de 2011

6 votos

Hi,
one simple method would be to use lower on both the sentences and the words you are using ...
Titus

1 comentario

I just used this solution, thanks!
strfind(lower(bigText),lower(keyword))

Iniciar sesión para comentar.

Más respuestas (2)

Fangjun Jiang
Fangjun Jiang el 24 de Jul. de 2011

1 voto

use regexpi

1 comentario

Turner
Turner el 20 de Ag. de 2013
takes 10 times longer than lower/upper followed by strfind() in my benchmark

Iniciar sesión para comentar.

Bjorn Gustavsson
Bjorn Gustavsson el 24 de Jul. de 2011

0 votos

Use: strcmpi

2 comentarios

Walter Roberson
Walter Roberson el 25 de Jul. de 2011
strcmpi() is not suitable for substring searches. See http://www.mathworks.com/help/techdoc/ref/strcmpi.html about what it _does_ do.
Bjorn Gustavsson
Bjorn Gustavsson el 25 de Jul. de 2011
I misread the original poster's strfind as strcmp...

Iniciar sesión para comentar.

Categorías

Más información sobre Characters and Strings en Centro de ayuda y File Exchange.

Preguntada:

New
el 24 de Jul. de 2011

Comentada:

el 11 de Ag. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by