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 #49754 is a reply to message #49749] Tue, 15 August 2006 15:40 Go to previous messageGo to previous message
Mike[2] is currently offline  Mike[2]
Messages: 99
Registered: December 2005
Member
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.

Take a look at the uniq function. Here's an example:

IDL> a=[1,2,3,4,5,6,7,7,8,8,8]
IDL> print, a
1 2 3 4 5 6 7 7
8 8 8
IDL> print, a[uniq(a)]
1 2 3 4 5 6 7 8

Using your data:

IDL> A = [[20.4, 40.3, 50.2, 50.2], [30.2, 60.2, 32.4, 32.4]]
IDL> i = uniq(A[*,0])
IDL> B = [[(A[*,0])[i]], [(A[*,1])[i]]]
IDL>
IDL> print, A
20.4000 40.3000 50.2000 50.2000
30.2000 60.2000 32.4000 32.4000
IDL> print, B
20.4000 40.3000 50.2000
30.2000 60.2000 32.4000

Mike
[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 00:11:05 PDT 2025

Total time taken to generate the page: 0.08675 seconds