<< specfun_factoriallog Discrete Maths specfun_nchoosek >>

Specfun >> Specfun > Discrete Maths > specfun_ismember

specfun_ismember

Array elements that are members of set.

Calling Sequence

tf = specfun_ismember ( a , s )

Parameters

a :

a ma-by-na matrix

s :

a 1-by-ns matrix

tf :

a ma-by-na matrix of booleans, tf(i,j) is %t if there is an entry in s matching a(i,j).

Description

Search in a the entries which are in s.

Uses vectorized statements, based on the Kronecker product. The intermediate memory required is ma*na*ns.

Examples

a = (1:5)'
s = [0 2 4 6 8 10 12 14 16 18 20]
tf = specfun_ismember ( a , s )
expected = [%f %t %f %t %f]'

// An example with a matrix
a = [
7 35 14 86 76
15 51 24 96 49
35 40 46 35 93
85 34 74 82 22
];
s = [51 74 22 15 86]
tf = specfun_ismember(a, s)

// With strings
a = ["1" "2" "3" "4" "5"];
s = ["0" "2" "4" "6" "8" "10" "12" "14" "16" "18" "20"];
tf = specfun_ismember(a, s)

Authors


Report an issue
<< specfun_factoriallog Discrete Maths specfun_nchoosek >>