Path: news.mathworks.com!not-for-mail
From: "Justin " <riley127099@yahoo.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Explicit Loops
Date: Sun, 8 Nov 2009 23:54:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 27
Message-ID: <hd7lmp$p6d$1@fred.mathworks.com>
References: <hd7jqq$1h4$1@fred.mathworks.com> <hd7kqd$g98$1@news.eternal-september.org>
Reply-To: "Justin " <riley127099@yahoo.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1257724441 25805 172.30.248.35 (8 Nov 2009 23:54:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 8 Nov 2009 23:54:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1995558
Xref: news.mathworks.com comp.soft-sys.matlab:583439


dpb <none@non.net> wrote in message <hd7kqd$g98$1@news.eternal-september.org>...
> Justin wrote:
> > What I want to do is write a function that will return all
> > locations at which a random chain of letters appears in a longer chain
> > of letters.  
> > So if the smaller chain of random letter, "motif" is aar and the
> > longer chain, "protein" is abbdaardkadaar, the function will return the
> > location of aar at 5 and 12. Here's what I have so far, but something
> > is off. I would really appreciate some assistance. Thank so much!
> 
> > 
> > function loc=Motif_Find(motif,protein)
>      loc = findstr(protein, motif);
> > end
> 
> Example from command window...
> 
>  >> p = 'abbdaardkadaar';
>  >> m = 'aar';
>  >> findstr(p,m)
> ans =
>       5    12
>  >>
> 
> --

Oh right. Thanks. But is there a way to do this just using explicit looping? I'm trying to practice my looping and I want to be able to understand the mechanics behind findstr