File Exchange

image thumbnail

INTERSECTALL

version 1.3 (3.05 KB) by

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

0 Downloads

Updated

View License

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.

Comments and Ratings (4)

Mehmet Suzen

Mehmet Suzen (view profile)

@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.

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?

Mehmet Suzen

Mehmet Suzen (view profile)

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

peter

peter (view profile)

can you put an example, thanks

Updates

1.3

A new function INTERSECTALLSET is added. Description is improved.

1.2

Function documentation update

1.1

Added an example

MATLAB Release
MATLAB 7.14 (R2012a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video