how to find the position in a string array

8 visualizaciones (últimos 30 días)
Shown
Shown el 6 de Abr. de 2014
Comentada: Jan el 6 de Abr. de 2014
attributes={'aaaa','bbbb','cccc','dddd' };
str='cccc';
how to find position 3 ?

Respuesta aceptada

Walter Roberson
Walter Roberson el 6 de Abr. de 2014
Read the documentation in ismember()
  2 comentarios
Shown
Shown el 6 de Abr. de 2014
thanks, I got it.
[a,b]=ismember(str,attributes)
b
Jan
Jan el 6 de Abr. de 2014
I'd prefer this instead:
index = find(strcmp(attributes, str))

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by