comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » greater than X and less than Y
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
greater than X and less than Y [message #36223] Thu, 28 August 2003 10:34 Go to next message
bradbury is currently offline  bradbury
Messages: 3
Registered: August 2003
Junior Member
Here is an easy one:

I can find the location of data in my array at the top and at the
bottom of it's range. But how do I find the location of the
data in the middle of this range.

example:

data=[10,35,11,5,17,5,24,13,22,30,8,20,1,16,19,31,29,3,23,33 ,37]

N=size(data,/N_elements)

; returns a vector of subscripts that allows access
; to the elements of "data" in ascending order
sort_data=sort(data)

; returns "data" values in ascending order
new_data=data[sort_data]

; calculates "data's" 66th percentile
top66=new_data(0.66*N)

; returns vector with ones in place of values in
; top 66 percentile of "data"
high66=data gt top66

; calculates "data's" 33rd percentile
bot33=new_data(0.33*N)

; returns vector with ones in place of values in
; bottom 33 percentile of "data"
low33=data lt bot33

Using a similar method (or not) how would I create
a "mid33," and thus gain access to the data in the range
between the bottom 33rd and the upper 66th percentiles.

SO, I guess my problem is with using the operators "gt" and "lt."

Thanks very much, in advance...
Re: greater than X and less than Y [message #36308 is a reply to message #36223] Thu, 28 August 2003 22:07 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
bradbury@geo.umass.edu (James Bradbury) writes:
...
> ; returns vector with ones in place of values in
> ; top 66 percentile of "data"
> high66=data gt top66
>
> ; calculates "data's" 33rd percentile
> bot33=new_data(0.33*N)
>
> ; returns vector with ones in place of values in
> ; bottom 33 percentile of "data"
> low33=data lt bot33
>
> Using a similar method (or not) how would I create
> a "mid33," and thus gain access to the data in the range
> between the bottom 33rd and the upper 66th percentiles.

The problem is easily solved when you use the AND operator as well.

mid33 = (data GE bot33) AND (data LE top33)

Craig


--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: working with IDLtoAVI.dlm
Next Topic: map_patch and triangulating satellite images

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 09:19:43 PDT 2025

Total time taken to generate the page: 1.27989 seconds