ismember(3f) - [M_sets] Create a mask of A marking elements also in B
Synopsis
Description
Options
Returns
Examples
Authors
License
ismember(A,B)
Identifies elements of the first set that are members of the second set as well.
The returned array is a mask of the first array containing a 1 (aka. "true") where the data in A is found in B. Elsewhere, the array contains 0 (aka. "false").
A input array B input array of values to find in vector A.
A mask of array A with a 1 at locations where the value in that position in A is also a value that occurs in B, and with a 0 at locations where that value in A was not found in B.
sample program:
program demo_ismember use M_sets, only: ismember character(len=*),parameter :: g=(*(g0,1x)) integer, allocatable :: A(:) integer, allocatable :: B(:)Results:write(*,g) ISMEMBER, Determine which elements of A are also in B.
A=[5,3,4,2] B=[2,4,4,4,6,8] write(*,g) A=, A write(*,g) B=, B write(*,g) ismember(A,B)
end program demo_ismember
> ISMEMBER Determine which elements of A are also in B. > A= 5 3 4 2 > B= 2 4 4 4 6 8 > 0 0 1 1
John S. Urban, 2023-07-20
CC0-1.0
Nemo Release 3.1 | ismember (3) | February 23, 2025 |