Mercurial > hg > c4dm-chord-transcriptions
comparison evaluationtools/compareunorderedsets.m @ 1:8973548174c1 tip
adding tools to repo
author | christopherh |
---|---|
date | Mon, 06 May 2013 14:43:47 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:0a4ad3e72e75 | 1:8973548174c1 |
---|---|
1 | |
2 function [match,success,errormessage] = compareunorderedsets(set1,set2,cardinality) | |
3 | |
4 | |
5 if nargin<3 | |
6 cardinality = 6; | |
7 end | |
8 | |
9 | |
10 | |
11 errormessage = ''; | |
12 success = 1; | |
13 match = 0; | |
14 | |
15 | |
16 | |
17 if strcmp(class(set1),class(set2)) | |
18 | |
19 | |
20 % make sure that the sets don't contain duplicate objects | |
21 X = unique(set1); | |
22 Y = unique(set2); | |
23 | |
24 | |
25 u = length(intersect(X,Y)); | |
26 | |
27 m = min(cardinality,max(length(X),length(Y))); | |
28 | |
29 if u >= m | |
30 | |
31 match = 1; | |
32 | |
33 else | |
34 | |
35 match = 0; | |
36 | |
37 end | |
38 else | |
39 success = 0; | |
40 errormessage = 'Error in compareunorderedsets: trying to compare mixed data types'; | |
41 end |