Team:Alberta/Project/Modeling/FindMatches

From 2009.igem.org

Revision as of 07:05, 2 October 2009 by Ebennett (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
%Finds the number of elements in List2 that match with
%any other element in List1.  Also makes a new list consisting of those
%matches from List2.  (It does not make a difference which list is which unless there
%are repeats in a single list).

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

%example: List1 = invertedGeneListArray{z}; or List1 = literatureGenes;
%example: List2 = SuspectedEssentialGenes;  or List2 = model.genes;

r=1;
MatchList=cell(1);
Match=zeros(size(List1));

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);