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

Home » Public Forums » archive » Re: Matching elements in two arrays of different sizes
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: Matching elements in two arrays of different sizes [message #80684 is a reply to message #80653] Tue, 26 June 2012 13:28 Go to previous message
Russell Ryan is currently offline  Russell Ryan
Messages: 122
Registered: May 2012
Senior Member
On Tuesday, June 26, 2012 12:07:29 PM UTC-4, pindsy wrote:
> Hi everyone,
>
> I am having trouble figuring out how to search through an array of size [1,17824] and match it to the points in another array of size [1,70].
>
> What I am trying to use to match the two arrays are the month, day, year, hour, and minute within each dataset. I have made two arrays using julday and have been trying to go through each of those arrays to find matches. However, it only searches up to the 70 first lines of the larger array and dosen't give all the possible matches.
>
> Any ideas on how to fix this would be helpful.
>
> Cheers,
>
> Meredith



On Tuesday, June 26, 2012 12:07:29 PM UTC-4, pindsy wrote:
> Hi everyone,
>
> I am having trouble figuring out how to search through an array of size [1,17824] and match it to the points in another array of size [1,70].
>
> What I am trying to use to match the two arrays are the month, day, year, hour, and minute within each dataset. I have made two arrays using julday and have been trying to go through each of those arrays to find matches. However, it only searches up to the 70 first lines of the larger array and dosen't give all the possible matches.
>
> Any ideas on how to fix this would be helpful.
>
> Cheers,
>
> Meredith

There are probably cleverer ways to do this, but the problem seems simple enough that a simple tool may be the best. Suppose the dates are d1 and d2 (d1 is the shorter vector)

maxmintime=0.01
n1=n_elements(d1)

mintime=fltarr(n1)
minid=lonarr(n1)
for i=0,n-1 do begin
dt=abs(d1(i)-d2)
mintime(i)=min(dt,loc)
minid(i)=loc
endfor

g=where(mintime lt maxmintime)
if g(0) ne -1 then begin
d1=d1(g)
d2=d2(minid(g))
endif else print,'No matches!'
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: problem in the path
Next Topic: Parallel Processing in IDL

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

Current Time: Wed Oct 08 19:28:21 PDT 2025

Total time taken to generate the page: 0.00453 seconds