Team:Alberta/Project/Modeling/FindMatches

From 2009.igem.org

% Finds and outputs the Matches between the two input lists and also outputs the number of matches.

function [ListOfMatches, NumberOfMatches] = FindMatches(List1,List2)

%Examples:
%correlation = FindMatches(LiteratureGenes, model.genes)
%correlation = FindMatches(MinGenomes{3}, UnessentialGenes{5})

r=1;
MatchList=cell(1);
Match=zeros(max(length(List1),length(List2)));

for a=(1:length(List1))
    for b=(1:length(List2))
        if strcmp(List1(a), List2(b)) == 1
            Match(b)=1;
        end
    end
end

for c=1:length(List2)
    if Match(c)==1
        MatchList(r)=List2(c);
        r=r+1;
    end
end
ListOfMatches=MatchList';
NumberOfMatches=sum(Match);