Find in Array of Strings

3 visualizaciones (últimos 30 días)
Sam Da
Sam Da el 28 de Jun. de 2011
how do i find the row number for 'STG' in the following array of names as: 'asf' 'poif' 'STG' 'iam' 'no'

Respuesta aceptada

Matt Fig
Matt Fig el 28 de Jun. de 2011
Is your array a cell array or a character array? If it is a cell array,
A = {'asf'
'poif'
'STG'
'iam'
'no'}
strmatch('STG',A)
Or you can use:
find(strcmp(A,'STG'))
  1 comentario
Jan
Jan el 28 de Jun. de 2011
I prefer the faster STRCMP method. +1

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre String Parsing 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