Azzera filtri
Azzera filtri

Locate entire word in cell given a specific pattern

2 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Birdman
Birdman il 22 Gen 2018
regexp(strjoin(stringList),'[ell]')
  2 Commenti
GEORGIOS BEKAS
GEORGIOS BEKAS il 22 Gen 2018
can you also explain that to me? :)
Birdman
Birdman il 22 Gen 2018
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.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Characters and Strings in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by