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

Home » Public Forums » archive » Re: Array comparison
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: Array comparison [message #32330] Wed, 02 October 2002 13:44 Go to previous message
mchinand is currently offline  mchinand
Messages: 66
Registered: September 1996
Member
In article <Pine.GHP.4.32.0210021447020.18221-100000@icesat2.gsfc.nasa.gov>,
Jeff Guerber <jeff.guerber@gsfc.nasa.gov> wrote:
> On Wed, 2 Oct 2002, Mike Chinander wrote:
>
>> How about:
>>
>> if n_elements(uniq(([a,b])(sort([a,b])))) ne n_elements([a,b]) then print,
>> 'arrays have matching values'
>
> Uhh, doesn't that claim a match if one of the arrays contains two (or
> more) identical elements, even if the arrays have no elements in common?
>
> IDL> a=[1,2,3,4,5]
> IDL> b=[6,6,7]
> IDL> if n_elements(uniq(([a,b])(sort([a,b])))) ne n_elements([a,b]) then
> print,'match'
> match
> IDL>
>
> Jeff Guerber
>
Yeah, I realized this after reading the code from David Fanning's site
that he linked to in this thread. Applying UNIQ to the two arrays prior
to concatenating them should get around this.

--Mike


--
Michael Chinander
m-chinander@uchicago.edu
Department of Radiology
University of Chicago
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Looking for more ideas on code ...
Next Topic: Re: ROI application...

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

Current Time: Wed Oct 08 14:52:05 PDT 2025

Total time taken to generate the page: 0.00450 seconds