Function intersectN2 finds all common pairs of input vectors aL1_ and aL2_
L1 : N1x2 or 2xN1 vector
L2 : N2x2 or 2xN2 vector
U is a N3x2 vector containing all common elements
n1 : index vector common elements L1(n1,:) in L1.
n2 : index vector common elements L2(n2,:) in L2.
the following conditions are staisfied: isequal(L1(n1,:),L2(n2,:))
If there are no common errors U n1 and n2 are null contents.
Input Output Restrictions: 1.- The input vectors have to be of dimensions N1x2 N2x2 or 2xN1 2xN2
2.- Strict number of input arguments, only 2, no more than 2 input vectors
3.- Strict amount of output arguments, only 3, no more than 3
clear all;close all;clc
Author: John Bofarull, any comments to improve this function are welcome
at firstname.lastname@example.org or through the Mathworks forum to John BG email@example.com
1st release: April 8th 2018.
John BG (2022). intersectN2(L1,L2) finds all N1x2 N2x2 common pairs as well as respective indices to common pairs. (https://www.mathworks.com/matlabcentral/fileexchange/66822-intersectn2-l1-l2-finds-all-n1x2-n2x2-common-pairs-as-well-as-respective-indices-to-common-pairs), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!