Team:Alberta/Project/Modeling/CheckForRepeats

From 2009.igem.org

%Will return a list of the inputs repeats and the input list without repeats
function [TheRepeats, WithoutRepeats] = CheckForRepeats(CheckThisList)

NumberOfAppearances=zeros(1,length(CheckThisList));
for a=(1:length(CheckThisList))
    for b=(a:length(CheckThisList))
        if strcmp(CheckThisList(a),CheckThisList(b))==1
            NumberOfAppearances(a)=NumberOfAppearances(a)+1;
        end
    end
end
NumberOfAppearances = NumberOfAppearances'

if sum(NumberOfAppearances)==length(CheckThisList)
    'No Repeats'
else
end
q=1;
TheRepeats=cell(1);
for t=(1:length(NumberOfAppearances))
    if NumberOfAppearances(t)~=1
       TheRepeats(q)=CheckThisList(t);
       q=q+1;
    end
end
TheRepeats=TheRepeats'

WithoutRepeats = unique(CheckThisList);