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)!
"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.
"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!
A=[.....] (1,600);
numcell(A); % (for example) =600
b=numcell(A)/number of lines
(line number)*b+1
I hope I understood your question rightly
"helper " <spamless@nospam.com> wrote in message
<g0htbq$bhf$1@fred.mathworks.com>...
> > firstNext = ceil((cPt-1)/200)*200 + 1
> >
> > Note that I had to use (cPt-1) to handle the case where
> > cPt=200.
>
>
> Ooops. Looking at this again, I was wrong. No need to use
> cPt-1
>
> firstNext = ceil(cPt/200)*200 + 1
>
> is sufficient.
"Archana Ananthanarayan" <archana1985_ms@hotmail.com> wrote
in message <g0htnm$4s9$1@fred.mathworks.com>...
> "helper " <spamless@nospam.com> wrote in message
> <g0htbq$bhf$1@fred.mathworks.com>...
> > > firstNext = ceil((cPt-1)/200)*200 + 1
> > >
> > > Note that I had to use (cPt-1) to handle the case where
> > > cPt=200.
> >
> >
> > Ooops. Looking at this again, I was wrong. No need to use
> > cPt-1
> >
> > firstNext = ceil(cPt/200)*200 + 1
> >
> > is
sufficie------------------------------------------------------------
>
> thanks for all the replies! Its working!! Thanks a ton!
>
"Archana Ananthanarayan" <archana1985_ms@hotmail.com>
wrote in message <g0jpn2$p6n$1@fred.mathworks.com>...
> "Archana Ananthanarayan" <archana1985_ms@hotmail.com>
wrote
> in message <g0htnm$4s9$1@fred.mathworks.com>...
> > "helper " <spamless@nospam.com> wrote in message
> > <g0htbq$bhf$1@fred.mathworks.com>...
> > > > firstNext = ceil((cPt-1)/200)*200 + 1
> > > >
> > > > Note that I had to use (cPt-1) to handle the case
where
> > > > cPt=200.
> > >
> > >
> > > Ooops. Looking at this again, I was wrong. No need
to use
> > > cPt-1
> > >
> > > firstNext = ceil(cPt/200)*200 + 1
> > >
> > > is
> sufficie-------------------------------------------------
-----------
> >
> > thanks for all the replies! Its working!! Thanks a ton!
> >
>
> ---------------------------------------------------------
--
>
> The equation is not working when cPt assumes the values
> 150,250 etc.,
>
> How to solve this?
>
Hi,
what exactly is the problem ??
i checked for 150/250 etc and above gives correct
result....
Please tell the error message and result u get .
> Hi,
>
> what exactly is the problem ??
> i checked for 150/250 etc and above gives correct
> result....
> Please tell the error message and result u get .
>
> with reagrds,
> Nitin
>
--------------------------------------------------------
Its working now!! i will get back when i encounter any
error. thanks!
Tags for this Thread
Add a New Tag:
Separated by commas
Ex.: root locus, bode
What are tags?
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.
Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central. Read the complete Disclaimer prior to use.