Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Explicit Looping
Date: Sat, 7 Nov 2009 09:13:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 19
Message-ID: <hd3dmu$k1n$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1257585182 20535 172.30.248.38 (7 Nov 2009 09:13:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 7 Nov 2009 09:13:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2081392
Xref: news.mathworks.com comp.soft-sys.matlab:583196


I am trying to write a function that will that take a random assortment of numbers (motif) and if the 'motif' is in the designated location of the longer chain of random numbers (protein), it will return as "1" or "true." Otherwise, it will return as "0". I'm not entirely familiar with how for works but here is my coding so far. I think it's on the right track; does anybody know what I did wrong. 

Thanks so much!


function a=Motif_Match(motif,protein,location)
[rows cols]=size(protein);
if rows~=1
    disp('motif_match only accepts vectors')
else
    
    
    for i=location:cols
        if motif==protein(i)
            a=1;
        
        end
    end
end