Path: news.mathworks.com!not-for-mail
From: "helper " <spamless@nospam.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Jumping to the next interval
Date: Thu, 15 May 2008 17:42:03 +0000 (UTC)
Organization: Timothy S. Farajian, Inc.
Lines: 27
Message-ID: <g0hslb$4o$1@fred.mathworks.com>
References: <g0hs2i$ntm$1@fred.mathworks.com>
Reply-To: "helper " <spamless@nospam.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1210873323 152 172.30.248.37 (15 May 2008 17:42:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 15 May 2008 17:42:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1272923
Xref: news.mathworks.com comp.soft-sys.matlab:468653


"Archana Ananthanarayan" <archana1985_ms@hotmail.com> wrote 
in message <g0hs2i$ntm$1@fred.mathworks.com>...
> My problem goes like this :
> 
> I've a number line extending say from 0 to 600. I've 
divided
> the line into equal intervals of 200 each. now i'm at 151 
of
> the 1st section. i need to jump to the next section say
> number 201(of course - due to a condition), how do i
> calculate the 1st number of the next interval? (that is 
201)!
> 
> Thanks in Advance!

First, if your line is from 0 to 600, you have 601 points, 
not 600.  So let's assume your line is from 1 to 600.

If you know your current point is cPt = 151, then you can 
get the first point of the next section using:

firstNext = ceil((cPt-1)/200)*200 + 1

Note that I had to use (cPt-1) to handle the case where 
cPt=200.