ismember
Array elements that are members of another array.
📝Syntax
T = ismember(A, B)
[T, loc] = ismember(A, B)
📥Input Arguments
Parameter Description
A a variable
B a variable
📤Output Arguments
Parameter Description
T result of ismember.
loc lowest index in B for each matching element of A, 0 where there is no match.
📄Description

T = ismember(A, B) returns an array of logical where the data inA is found in B.

[T, loc] = ismember(A, B) also returns loc, the lowest index in B for each element of A that is a member of B, and 0 otherwise.

💡Examples
A = [50 30 40 20];
B = [20 40 40 40 60 80];
T = ismember(A, B)

T = ismember(["a","b","f"], ["b", "f", "c"])
🔗See Also
sort
🕔Version History
Version Description
1.0.0 initial version
Edit this page on GitHub