Find indexes of string elements inside another string

Hello
I have two strings like:
A=["a" "b" "c" "d" "e" "f" "g"]
B=["b" "d" "f" "a"]
How can I know that elements in B inside A is B_index=[2 4 6 1]?
Thanks for helping!

 Respuesta aceptada

Walter Roberson
Walter Roberson el 12 de Ag. de 2019
Editada: Walter Roberson el 12 de Ag. de 2019
[~, B_index] = ismember(B,A)

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Centro de ayuda y File Exchange.

Productos

Versión

R2018b

Preguntada:

el 12 de Ag. de 2019

Comentada:

el 12 de Ag. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by