Find indexes of string elements inside another string

13 次查看(过去 30 天)
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