diff evaluationtools/compareunorderedsets.m @ 1:8973548174c1 tip

adding tools to repo
author christopherh
date Mon, 06 May 2013 14:43:47 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/evaluationtools/compareunorderedsets.m	Mon May 06 14:43:47 2013 +0100
@@ -0,0 +1,41 @@
+
+function [match,success,errormessage] = compareunorderedsets(set1,set2,cardinality)
+
+
+if nargin<3
+    cardinality = 6;
+end
+
+
+
+errormessage = '';
+success = 1;
+match = 0;
+
+
+
+if strcmp(class(set1),class(set2))
+
+
+        % make sure that the sets don't contain duplicate objects
+        X = unique(set1);
+        Y = unique(set2);
+
+
+        u = length(intersect(X,Y));
+
+        m = min(cardinality,max(length(X),length(Y)));
+
+        if u >= m
+
+            match = 1;
+
+        else
+
+            match = 0;
+
+        end
+else
+     success = 0;
+     errormessage = 'Error in compareunorderedsets: trying to compare mixed data types';
+end