Find indexes of string elements inside another string

조회 수: 20 (최근 30일)
Eduard Mazur
Eduard Mazur 2019년 8월 12일
댓글: Eduard Mazur 2019년 8월 12일
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개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by