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 #89094 is a reply to message #89093] Wed, 23 July 2014 23:26 Go to previous messageGo to previous message
Moritz Fischer is currently offline  Moritz Fischer
Messages: 32
Registered: June 2013
Member
Unless you know more about the nature of those track numbers I'd loop
over them. You can get the track numbers using UNIQ() and then do
something like this:

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

for i=0,n_elements(tn)-1 do begin

subset = WHERE( yourarray[1,*] EQ tn[i] )

void = min(abs( yourarray[0,subset] + 42. ), min_index )

value[i] = yourarr[0, subset[min_index] ]

end


Am 24.07.2014 03:50, schrieb gpeterso@ucsc.edu:
> So i have an array that is [2,58]. I need the number that is closet
> to -42 for each time the track number increases by one. So for
> example for track number 28742 I should get the third bin number of
> -42.6996. I am very confused on how to do approach this.
>
>
>
[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 17:08:48 PDT 2025

Total time taken to generate the page: 0.00400 seconds