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

Home » Public Forums » archive » Re: Extract elements from floating-point array
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
Re: Extract elements from floating-point array [message #59701] Sun, 06 April 2008 12:20 Go to next message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article
<f91355dd-4389-4bf7-abc9-1525b88e8511@8g2000hsu.googlegroups.com>,
moxament@gmail.com wrote:

> Dear IDL group members,
>
> I am beginner in the IDL programming and I have a lot of problems :(.
> My question now is the following:
>
> I have a floating-point array Rdata with 335412 elements. The values
> of the elements are between 5.9e+009 minimum and 3.7e+0013 maximum. I
> want to extract the elements of the array where Rdata(i) > Rdara(i-1)
> and Rdata(i) > Rdata(i+1) and put them in a new array, lets say
> Rdata_new.
>
> Can anyone help me PLEASE. I tried ptrarr and ptr_new but I could not
> get any result.
>
> In addition, I do not know why I usually have problems when I deal in
> IDL with arrays like the one I mentioned before??? as I said I am
> beginner and I do not know if IDL has problems with huge arrays like
> mines with such element values.
>
> any help will be appreciated.
>
> Mohammed Dabboor

i = WHERE((rdata GT SHIFT(rdata, 1)) AND (rdata[1:n-2]: GT SHIFT(rdata, -1)), count)
IF (count GT 0) THEN peaks = rdata[i]

SHIFT does a circular shift, so don't forget to treat the first and last elements
separately.

Ken Bowman
Re: Extract elements from floating-point array [message #59705 is a reply to message #59701] Sun, 06 April 2008 13:17 Go to previous message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Apr 6, 10:28 am, moxam...@gmail.com wrote:
> Dear IDL group members,
>
> I am beginner in the IDL programming and I have a lot of problems :(.
> My question now is the following:
>
> I have a floating-point array Rdata with 335412 elements. The values
> of the elements are between 5.9e+009 minimum and 3.7e+0013 maximum. I
> want to extract the elements of the array where Rdata(i) > Rdara(i-1)
> and Rdata(i) > Rdata(i+1) and put them in a new array, lets say
> Rdata_new.
>
> Can anyone help me PLEASE. I tried ptrarr and ptr_new but I could not
> get any result.
>
> In addition, I do not know why I usually have problems when I deal in
> IDL with arrays like the one I mentioned before??? as I said I am
> beginner and I do not know if IDL has problems with huge arrays like
> mines with such element values.
>
> any help will be appreciated.
>
> Mohammed Dabboor

You could try something like:
idx = where( Rdata gt shift(Rdata,1) and Rdata gt shift(Rdata,-1) )
Rdata_new = Rdata[idx]

You'll have to figure out how to deal with the "ends", i.e. Rdata[0]
and Rdata[n_elements(Rdata)-1]
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Extract elements from floating-point array
Next Topic: Another Late-Night Cautionary Tale: C() format code case sensitivity!

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

Current Time: Fri Oct 10 11:15:08 PDT 2025

Total time taken to generate the page: 1.04089 seconds