||
A=[1,2,3,4,5,7,1];
B=[1,3,5,6];
Determine which elements of B are also in A as well as their corresponding locations in A.
Syntax: [yn,pos]=ismember(B,A);
Output: yn=[1,1,1,0] % if an element of B is found in A, then yn returns 1 (ture), elsewhere, it returns 0 (false).
pos=[1,3,5,0] % find the lowest index of locations. The lowest position index to B(1) is A(1).
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2025-1-10 17:17
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社