
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
