Team:Alberta/Project/Modeling/FindMatches

From 2009.igem.org

(Difference between revisions)
 
(One intermediate revision not shown)
Line 1: Line 1:
-
 
+
 
-
  %Finds the number of elements in List2 that match with any other element in List1.  Also makes a new list consisting of those
+
  % Finds and outputs the Matches between the two input lists and also outputs the number of matches.
-
%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)
  function [ListOfMatches, NumberOfMatches] = FindMatches(List1,List2)
   
   
-
  correlation = FindMatches(LiteratureGenes, model.genes)
+
  %Examples:
 +
%correlation = FindMatches(LiteratureGenes, model.genes)
 +
%correlation = FindMatches(MinGenomes{3}, UnessentialGenes{5})
   
   
  r=1;
  r=1;
  MatchList=cell(1);
  MatchList=cell(1);
-
  Match=zeros(size(List1));
+
  Match=zeros(max(length(List1),length(List2)));
   
   
  for a=(1:length(List1))
  for a=(1:length(List1))

Latest revision as of 03:43, 18 October 2009

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