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

Home » Public Forums » archive » Re: Removing equal elements from an array
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Removing equal elements from an array [message #49757 is a reply to message #49756] Tue, 15 August 2006 09:30 Go to previous messageGo to previous message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
I'm sure there is a built in function that I am unaware of but here is
one way:

b = a - shift(a,2)
c = a[*, where(b[1,*] ne 0)]

IDL> print, a
20.4000 30.2000
40.3000 60.2000
50.2000 32.4000
50.2000 32.4000
IDL> b = a - shift(a,2)
IDL> print, b
-29.8000 -2.20000
19.9000 30.0000
9.90000 -27.8000
0.000000 0.000000
IDL> c = a[*, where(b[1,*] ne 0)]
IDL> print, c
20.4000 30.2000
40.3000 60.2000
50.2000 32.4000

-Rick

Julio wrote:
> Another question... please help me!!
>
> I have an array 'A' with two columns, latitudes and longitudes, and
> several lines. A need to make another array with the elements of A that
> don't repeat. An example:
>
> A[0]=[20.4, 40.3, 50.2, 50.2]
> A[1]=[30.2, 60.2, 32.4, 32.4]
>
> Note that the third and fourth pairs are the same (50.2, 32.4). So, I
> need to make another array and remove one of the pairs. So, I would
> have:
>
> A[0]=[20.4, 40.3, 50.2]
> A[1]=[30.2, 60.2, 32.4]
>
> Do you have any idea how to do that??
>
> Thanks!
>
> Julio
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: File_COPY
Next Topic: SETENV

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

Current Time: Sat Oct 11 15:55:41 PDT 2025

Total time taken to generate the page: 1.27665 seconds