- strfind
- ismember
- contains
Is there a dsearchn equivalent for strings?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Reza Yahyaei
el 27 de Ag. de 2020
Comentada: Reza Yahyaei
el 5 de Dic. de 2020
I have two cell arrays, one is the array I want to find indices of multiple strings. Say q = { 'A', 'B' } and p = { 'H', 'F', ..., 'Z' }. Is there a function that finds the strings and returns their indices like ans = [ 12, 3 ] ? Or the only way is to use a for loop and find(strcmp(...)) which doesn't seem very efficient?
0 comentarios
Respuesta aceptada
Cris LaPierre
el 27 de Ag. de 2020
I think you would have to do it one value at a time.
find(contains(p,q(1)))
There are several functions you could use
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrix Indexing 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!