imat_ctrace/ismember


Purpose

Find imat_ctrace coordinates in another imat_ctrace.

Syntax

tf=ismember(a,s)
[tf,loc]=ismember(a,s)

Description

ISMEMBER for the imat_ctrace A returns a vector TF of the same length as A containing 1 where the coordinates of A are in the imat_ctrace S and 0 otherwise. LOC is an optional output index array containing the highest absolute index in S for each element in A which is a member of S and 0 if there is no such index.

Starting in MATLAB R2013a, the behavior of ISMEMBER has changed. To preserve the behavior of previous versions of MATLAB, pass in the string 'legacy'.

Examples

>> a=imat_ctrace('1x','2y','3x');
>> s=imat_ctrace('1x','1y','1z','2x','2y','2z','3x','3y');
>> [tf,loc]=ismember(a,s)

tf =
     1
     1
     1

loc =
     1
     5
     7

>> [tf,loc]=ismember(s,a)

tf =
     1
     0
     0
     0
     1
     0
     1
     0

loc =
     1
     0
     0
     0
     2
     0
     3
     0

>>

See Also

imat_ctrace/intersect, imat_ctrace/setdiff, imat_ctrace/setxor, imat_ctrace/union, imat_ctrace/unique