intersectN2(L1,L2) finds all N1x2 N2x2 common pairs as well as respective indices to common pairs.

버전 1.0.0.0 (3.41 KB) 작성자: John BG
intersectN2(L1,L2) finds N1x2 N2x2 common pairs as well as respective indices to common pairs.
다운로드 수: 17
업데이트 날짜: 2018/4/8

라이선스 보기

Function intersectN2 finds all common pairs of input vectors aL1_ and aL2_
call: [U,n1,n2]=intersectN2(L1,L2)
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,:))
isequal(U,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
Test example:

clear all;close all;clc
L1=randi([-5 5],10,2)
L2=randi([-5 5],20,2)
[U,n1,n2]=intersectN(L1,L2)
U
L1(n1,:)
L2(n2,:)
isequal(L1(n1,:),L2(n2,:))

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Author: John Bofarull, any comments to improve this function are welcome
at jgb2012@sky.com or through the Mathworks forum to John BG jgb2012@sky.com
1st release: April 8th 2018.

인용 양식

John BG (2024). 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. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R2006b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Read, Write, and Modify Image에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0

added comment regarding strict input output number of arguments; 2 and only 2 input arguments, 3 and only 3 output arguments. Removed comment lines