Last change
on this file since 4 was
4,
checked in by zhangj, 10 years ago
|
Initial import--MML version from SOLEIL@2013
|
File size:
301 bytes
|
Line | |
---|
1 | function [n1,v1]=intland(v1,v2) |
---|
2 | %find the intersection of two integer arrays |
---|
3 | if isempty(v1) | isempty(v2) |
---|
4 | n1=0; |
---|
5 | v1=[]; |
---|
6 | return |
---|
7 | end |
---|
8 | |
---|
9 | %for each entry in v1, check if contained in v2 |
---|
10 | for ind=1:length(v1) |
---|
11 | if isempty(find(v2==v1(ind))) |
---|
12 | v1(ind)=0; |
---|
13 | end |
---|
14 | end |
---|
15 | |
---|
16 | v1=sort(v1(find(v1))); |
---|
17 | n1=length(v1); |
---|
Note: See
TracBrowser
for help on using the repository browser.