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!

 채택된 답변

Walter Roberson
Walter Roberson 2019년 8월 12일
편집: Walter Roberson 2019년 8월 12일
[~, B_index] = ismember(B,A)

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Characters and Strings에 대해 자세히 알아보기

제품

릴리스

R2018b

질문:

2019년 8월 12일

댓글:

2019년 8월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by