Shop OBEX P1 Docs P2 Docs Learn Events
comparing values in an array — Parallax Forums

comparing values in an array

ArchiverArchiver Posts: 46,084
edited 2003-11-05 22:25 in General Discussion
Hi All
my first post so hope I have done it correctly

thanks in advance for any advice

I not sure if you can do it, I got a bit confused in the manual ..

I want to set up an array on a BS2 that has variables in it and then get a
result that tells me if the array is ascending or descending and the position of
the results will be used also to decide a result i.e.

Array might look like these

( 1,2,0,1,2,3,0,1) a result here would be low high gap low high ignoring the 0
and last one

(334,335,336,3,1000,1120,1,5) a result here would be low to high ignore 3 as its
a error

as you can see I can not set a >< as the variables range from 0 - 3000 possibly

I sort of did it with IF OR AND THEN statements just using the variables but the
permutation are to high and some results skip by which maybe the same as the
array idea but be a bit neater as I hope to use the position in working out a
result answer.

I am not after the answer on working out the result just an idea on a better way
than using if then and comparing the input variables any ideas?

Thanks
Rob

This email is confidential and may also be privilege.
If you are not the intended recipient, please notify us immediately.
You should not copy or use it for any purpose, nor disclose it's contents to any
other person.

[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-11-05 07:10
    >Hi All
    >my first post so hope I have done it correctly
    >
    >thanks in advance for any advice
    >
    >I not sure if you can do it, I got a bit confused in the manual ..
    >
    >I want to set up an array on a BS2 that has variables in it and then
    >get a result that tells me if the array is ascending or descending
    >and the position of the results will be used also to decide a result
    >i.e.
    >
    >Array might look like these
    >
    >( 1,2,0,1,2,3,0,1) a result here would be low high gap low high
    >ignoring the 0 and last one
    >
    >(334,335,336,3,1000,1120,1,5) a result here would be low to high
    >ignore 3 as its a error
    >
    >as you can see I can not set a >< as the variables range from 0 -
    >3000 possibly
    >
    >I sort of did it with IF OR AND THEN statements just using the
    >variables but the permutation are to high and some results skip by
    >which maybe the same as the array idea but be a bit neater as I hope
    >to use the position in working out a result answer.
    >
    >I am not after the answer on working out the result just an idea on
    >a better way than using if then and comparing the input variables
    >any ideas?
    >
    >Thanks
    >Rob


    I'm not sure what you are trying to do here. One standard way to
    detect a trend is to find the straight line that is the best fit to
    the sequence of values. Y = m * X + b. Here the X values are just
    the sequence of array index, 0,1,2,..,8. There are standard methods
    for doing this, using least squares regression. But it gets more
    complicated when it has to ignore some of the data, because they are
    errors or do not meet some criteria. The computer has to know what
    to ignore and what to count.
  • ArchiverArchiver Posts: 46,084
    edited 2003-11-05 22:25
    Thanks Tracy

    you have given me some things to think about...

    Original Message
    From: "Tracy Allen" <tracy@e...>
    To: <basicstamps@yahoogroups.com>
    Sent: Wednesday, November 05, 2003 5:40 PM
    Subject: Re: [noparse][[/noparse]basicstamps] comparing values in an array


    > >Hi All
    > >my first post so hope I have done it correctly
    > >
    > >thanks in advance for any advice
    > >
    > >I not sure if you can do it, I got a bit confused in the manual ..
    > >
    > >I want to set up an array on a BS2 that has variables in it and then
    > >get a result that tells me if the array is ascending or descending
    > >and the position of the results will be used also to decide a result
    > >i.e.
    > >
    > >Array might look like these
    > >
    > >( 1,2,0,1,2,3,0,1) a result here would be low high gap low high
    > >ignoring the 0 and last one
    > >
    > >(334,335,336,3,1000,1120,1,5) a result here would be low to high
    > >ignore 3 as its a error
    > >
    > >as you can see I can not set a >< as the variables range from 0 -
    > >3000 possibly
    > >
    > >I sort of did it with IF OR AND THEN statements just using the
    > >variables but the permutation are to high and some results skip by
    > >which maybe the same as the array idea but be a bit neater as I hope
    > >to use the position in working out a result answer.
    > >
    > >I am not after the answer on working out the result just an idea on
    > >a better way than using if then and comparing the input variables
    > >any ideas?
    > >
    > >Thanks
    > >Rob
    >
    >
    > I'm not sure what you are trying to do here. One standard way to
    > detect a trend is to find the straight line that is the best fit to
    > the sequence of values. Y = m * X + b. Here the X values are just
    > the sequence of array index, 0,1,2,..,8. There are standard methods
    > for doing this, using least squares regression. But it gets more
    > complicated when it has to ignore some of the data, because they are
    > errors or do not meet some criteria. The computer has to know what
    > to ignore and what to count.
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
Sign In or Register to comment.