Borrar filtros
Borrar filtros

How to find the corresponding position in a string

2 visualizaciones (últimos 30 días)
peter huang
peter huang el 30 de Ag. de 2022
Editada: Matt J el 30 de Ag. de 2022
How to find the corresponding string in a string set test_str = ['a';'b';'c'] test_str = 'a' 'b' 'c' How can i find out c and the output string is at position 3 of c

Respuestas (2)

Matt J
Matt J el 30 de Ag. de 2022
Editada: Matt J el 30 de Ag. de 2022
test_str={'a','b','c'};
[exists,location]=ismember('c',test_str)
exists = logical
1
location = 3

Matt J
Matt J el 30 de Ag. de 2022
Editada: Matt J el 30 de Ag. de 2022
test_str=['a','b','c']
test_str = 'abc'
location = strfind(test_str,'c')
location = 3

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