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.
|