Team:Alberta/Project/Modeling/FindMatches
From 2009.igem.org
(Difference between revisions)
(New page: %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...) |
|||
(2 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
- | %Finds the number of | + | |
- | + | % Finds and outputs the Matches between the two input lists and also outputs the number of matches. | |
- | + | ||
- | + | ||
function [ListOfMatches, NumberOfMatches] = FindMatches(List1,List2) | function [ListOfMatches, NumberOfMatches] = FindMatches(List1,List2) | ||
- | % | + | %Examples: |
- | % | + | %correlation = FindMatches(LiteratureGenes, model.genes) |
+ | %correlation = FindMatches(MinGenomes{3}, UnessentialGenes{5}) | ||
r=1; | r=1; | ||
MatchList=cell(1); | MatchList=cell(1); | ||
- | Match=zeros( | + | 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);