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

Home » Public Forums » archive » IDL Array Question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
IDL Array Question [message #84799] Tue, 11 June 2013 13:38
oh_wilkes is currently offline  oh_wilkes
Messages: 1
Registered: June 2013
Junior Member
Hello,

My adviser is out of town for the next week so hopefully someone here can help me!

I am supposed to use two FOR loops to calculate two functions then map the function of the first loop to the function of the second. I have accomplished this, getting a scatter plot of approximately 1440 points, which spaced themselves out into bins due to the nature of the functions. For reference, on the x-axis I have arrdis and on the y-axis I have what I call arrdin. Now I need to compile all of the arrdis values matched to their respective arrdin values into an array. However, when I print the array, I am only printing one row at a time. That is, when the array (arrdata=[arrdis,arrdin]) prints, it overwrites the previous values.

Is there a way to compile all of these into one array so that I can bin them and find averages for each bin?

Here is an outline of my program, if helpful:

pro calcplot

scans=get_scan_numbers(numscans)

arrlon=make_array(numscans,/float,value=0)
arrlat=make_array(numscans,/float,value=0)
arrins=make_array(numscans,/float,value=0)

arrdis=make_array(numscans,/float,value=0)
arrdin=make_array(numscans,/float,value=0)

arrdlon=make_array(numscans,/float,value=0)
arrdlat=make_array(numscans,/float,value=0)
arrdins=make_array(numscans,/float,value=0)

arrdata=make_array(numscans,/float,value=0)

window,0
!x.title='log(d)'
!y.title='log(D)'

for i=0,119 do begin

for j=1,120 do begin

getrec,i
[a bunch of math, irrelevant to find loni, lati, and insi for a given i]

arrlon[i]=loni
arrlat[i]=lati
arrins[i]=insi

getrec,j
[the same equations as above with different variables to find lonj,latj, and insj for a given j]

arrlon[j]=lonj
arrlat[j]=latj
arrins[j]=insj

dlon=arrlon[i]-arrlon[j]
dlat=arrlat[i]-arrlat[j]
dins=arrins[i]-arrins[j]

dis=[dlon^2+dlat^2]^(0.5)
din=[dins^2]^(0.5)

logdis=alog10(dis)
logdin=alog10(din)

arrdis=logdis
arrdin=logdin
arrdata=[arrdis,arrdin]

print,arrdata

plot,arrdis,arrdin,/noerase,psym=3, $
xrange=[-1.50,0.50],yrange=[0.0,1.4]

endfor

endfor

end


I just started learning IDL last week, so please forgive me if this makes little sense.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Updating FFmpeg libraries on MacOS
Next Topic: Faster way to "shift" array?

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

Current Time: Wed Oct 08 15:14:52 PDT 2025

Total time taken to generate the page: 0.00546 seconds