Method on @sym: ismember (x, S)
Method on @sym: ismember (x, M)

Test if an object is contained within a set or a matrix.

This function can be used in two ways, the first is to check if x is contained in a set S:

I = interval(sym(0), sym(pi));
ismember(2, I)
  ⇒ ans = 1

It can also be used to check if x is contained in a matrix M:

B = [sym(1) 2; 2*sym(pi) 4];
ismember(sym(pi), B)
  ⇒ ans = 0

In either case, the first argument x can also be a matrix:

A = [sym(3), 4 2; sym(1) 0 1];
ismember(A, B)
  ⇒ ans =
       0   1   1
       1   0   1

See also: @sym/unique, @sym/union, @sym/intersect, @sym/setdiff, @sym/setxor.

Package: symbolic