Hi Guys,
I'm wondering if someone can help me speed up my code. I'm basically looping through a large array and comparing values with two other large sorted arrays trying to find the value thats equal to or less than that value. I'm currently using a where procedure but I'm sure there has to be a faster way to search as I'm not looking for multiple values as the where finds, I'm just after one value. Anyway here is an example of my code:
For k = 0L, numDataElements-1 do begin
data_lon = data[k].point_x
data_lat = data[k].point_y
; find the indices from the lat-lon arrays
idx1 = where(lon LE data_lon, count1)
idx2 = where(lat LE data_lat, count2)
If (count1 GT 0) && (count2 GT 0) then begin
idx1 = idx1[count1-1]
idx2 = idx2[count2-1]
; do stuff here
endif
endfor
Thanks,
Tim
|