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

Home » Public Forums » archive » Locating desired values in 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: Locating desired values in an array. [message #89112 is a reply to message #89104] Fri, 25 July 2014 01:16 Go to previous messageGo to previous message
Moritz Fischer is currently offline  Moritz Fischer
Messages: 32
Registered: June 2013
Member
Sorry, my bad. UNIQ returns indices, not values. So it's even simpler:

idx = [-1,uniq( yourarray[1,*] )]
value = fltarr( n_elements(idx)-1 )

for i=0,n_elements(idx)-2 do begin

void = min(abs( yourarray[0, idx[i]+1:idx[i+1]] + 42. ), min_index )

value[i] = yourarray[0, idx[i]+1+min_index ]

end

However, note that this only works if the track numbers are sorted!
I'd stick to Matthew's approach, which is more generic!


Am 24.07.2014 20:19, schrieb gpeterso%ucsc.edu@gtempaccount.com:
> When I try your way I get an error that says: Attempt to subscript
> yourarray with subset is out if range
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL and C inter-language communication / call_external()
Next Topic: how can you convert CMIP5 model output time ?

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

Current Time: Wed Oct 08 19:35:43 PDT 2025

Total time taken to generate the page: 0.00449 seconds