Code covered by the BSD License  

Highlights from
INTERSECTALL

Be the first to rate this file! 20 Downloads (last 30 days) File Size: 3.05 KB File ID: #38968

INTERSECTALL

by

 

09 Nov 2012 (Updated )

Given set of sets, produce all possible intersections for each set or all sets at once.

| Watch this File

File Information
Description

Simple function INTERSECTALL efficiently returns intersections of given set of sets, computed combinatorially. It returns cell array of vectors of indices of a set that have instersection to any other set and a vector that gives number of intersections for each set. INTERSECTALLSET is much simpler, it returns the values of the set which are members of all sets.

Required Products MATLAB
MATLAB release MATLAB 7.14 (R2012a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (4)
29 Aug 2013 Mehmet Suzen

@Alle Meije,

Thanks for the feedback. I have added one more utility, called INTERSECTALLSET. It does what you need. Also, I've updated the description, hoping that now it is clear what INTERSECTALL produces.

28 Aug 2013 Alle Meije

Hi, thanks for this - but I don't understand your example.

I have a number of indices found in different maps say:

ind{1} = [ 1 3 4 5 6 7 9 ];
ind{2} = [ 1 2 3 6 7 8 9 ];
ind{3} = [ 2 3 4 5 6 7 8 ];

what I expect to find in the intersection of these 3 maps are the indices that are in all sets, i.e.
[3 6 7]. Is it possible to get that with your code?

09 Nov 2012 Mehmet Suzen

Just uploaded a new version with the following example, hope it helps:

vecSets = {[11, 12, 22, 14], [11, 15, 17, 22, 33], [ 17, 25, 14] }
[indexSet, numAllintersect] = intersectAll(vecSets);
indexSet{1}
ans =
1 3 4
indexSet{2}
ans =
1 3 4
indexSet{3}
ans =
1 3
numAllintersect
3
3
2

09 Nov 2012 peter

can you put an example, thanks

Updates
12 Nov 2012

Added an example

12 Nov 2012

Function documentation update

29 Aug 2013

A new function INTERSECTALLSET is added. Description is improved.

Contact us