X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 04 Apr 2011 09:54 AM by  anon
Accelerate Where() function
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
04 Apr 2011 09:54 AM
    I have a long 2-column array and need to subgroup the data. Something like this: a = dblarr(2,62500) readdata(file,a) for i=0,6250-1 do begin b = lindgen(100)+i*100 ; b may be random for j=0,99 do begin index = where(a[1,*] eq b[i], count) if (count ne 0) then sub = a[0,index] ... endfor endfor It is extremely slow for the indexing part. Is there a way to remove the inner for cycle but simply use where(a[1,*] eq b)? Do you have some suggestion to make the code faster? Thanks.

    Deleted User



    New Member


    Posts:
    New Member


    --
    05 Apr 2011 05:46 AM
    Hello, You may have a look on the "match" or "match2" procedures from IDL Astronomy Library : http://idlastro.gsfc.nasa...p/pro/misc/match.pro http://idlastro.gsfc.nasa.../pro/misc/match2.pro Cheers, Vincent
    You are not authorized to post a reply.