; IDL Version 5.3 (OSF alpha) ; Journal File for hahn@mithra.physics.montana.edu ; Working directory: /home/hahn ; Date: Wed Jun 9 14:15:02 2004 ; I forgot to do these examples as I was going through them, but ; i've reproduced them here. If there are any questions, as always, ; feel free to ask me. ; MAKING A PLOT x=findgen(150) print,x ; 0.00000 1.00000 2.00000 3.00000 4.00000 5.00000 ; 6.00000 7.00000 8.00000 9.00000 10.0000 11.0000 ; 12.0000 13.0000 14.0000 15.0000 16.0000 17.0000 ; 18.0000 19.0000 20.0000 21.0000 22.0000 23.0000 ; 24.0000 25.0000 26.0000 27.0000 28.0000 29.0000 ; 30.0000 31.0000 32.0000 33.0000 34.0000 35.0000 ; 36.0000 37.0000 38.0000 39.0000 40.0000 41.0000 ; 42.0000 43.0000 44.0000 45.0000 46.0000 47.0000 ; 48.0000 49.0000 50.0000 51.0000 52.0000 53.0000 ; 54.0000 55.0000 56.0000 57.0000 58.0000 59.0000 ; 60.0000 61.0000 62.0000 63.0000 64.0000 65.0000 ; 66.0000 67.0000 68.0000 69.0000 70.0000 71.0000 ; 72.0000 73.0000 74.0000 75.0000 76.0000 77.0000 ; 78.0000 79.0000 80.0000 81.0000 82.0000 83.0000 ; 84.0000 85.0000 86.0000 87.0000 88.0000 89.0000 ; 90.0000 91.0000 92.0000 93.0000 94.0000 95.0000 ; 96.0000 97.0000 98.0000 99.0000 100.000 101.000 ; 102.000 103.000 104.000 105.000 106.000 107.000 ; 108.000 109.000 110.000 111.000 112.000 113.000 ; 114.000 115.000 116.000 117.000 118.000 119.000 ; 120.000 121.000 122.000 123.000 124.000 125.000 ; 126.000 127.000 128.000 129.000 130.000 131.000 ; 132.000 133.000 134.000 135.000 136.000 137.000 ; 138.000 139.000 140.000 141.000 142.000 143.000 ; 144.000 145.000 146.000 147.000 148.000 149.000 x=x/150 x=x*!pi print,x ; 0.00000 0.0209440 0.0418879 0.0628319 0.0837758 0.104720 ; 0.125664 0.146608 0.167552 0.188496 0.209440 0.230383 ; 0.251327 0.272271 0.293215 0.314159 0.335103 0.356047 ; 0.376991 0.397935 0.418879 0.439823 0.460767 0.481711 ; 0.502655 0.523599 0.544543 0.565487 0.586431 0.607375 ; 0.628319 0.649262 0.670206 0.691150 0.712094 0.733038 ; 0.753982 0.774926 0.795870 0.816814 0.837758 0.858702 ; 0.879646 0.900590 0.921534 0.942478 0.963422 0.984366 ; 1.00531 1.02625 1.04720 1.06814 1.08909 1.11003 ; 1.13097 1.15192 1.17286 1.19381 1.21475 1.23569 ; 1.25664 1.27758 1.29852 1.31947 1.34041 1.36136 ; 1.38230 1.40324 1.42419 1.44513 1.46608 1.48702 ; 1.50796 1.52891 1.54985 1.57080 1.59174 1.61268 ; 1.63363 1.65457 1.67552 1.69646 1.71740 1.73835 ; 1.75929 1.78024 1.80118 1.82212 1.84307 1.86401 ; 1.88496 1.90590 1.92684 1.94779 1.96873 1.98968 ; 2.01062 2.03156 2.05251 2.07345 2.09440 2.11534 ; 2.13628 2.15723 2.17817 2.19911 2.22006 2.24100 ; 2.26195 2.28289 2.30383 2.32478 2.34572 2.36667 ; 2.38761 2.40855 2.42950 2.45044 2.47139 2.49233 ; 2.51327 2.53422 2.55516 2.57611 2.59705 2.61799 ; 2.63894 2.65988 2.68083 2.70177 2.72271 2.74366 ; 2.76460 2.78555 2.80649 2.82743 2.84838 2.86932 ; 2.89027 2.91121 2.93215 2.95310 2.97404 2.99499 ; 3.01593 3.03687 3.05782 3.07876 3.09970 3.12065 plot,x,sin(x),title='sine plot,xtitle='x',ytitle='sine of x' ; % Syntax error. plot,x,sin(x),title='sine plot',xtitle='x',ytitle='sine of x' ;(sorry, the syntax error above was because I missed an apostrophe) ; i can make this plot a postcript file by doing: set_plot, 'ps' plot,x,sin(x),title='sine plot',xtitle='x',ytitle='sine of x' ; open the file by doing gv, 'idl.ps' ; some people asked about saving files with a particular filename ; do the following device, filename='some_filename.ps' plot,x,sin(x),title='sine plot',xtitle='x',ytitle='sine of x' ; that will output the plot to the specified filename ; USE OF THE WHERE FUNCTION arr=[1,2,3,4,5,6,4] index=where(arr eq 4) print,index ; 3 6 print,arr(index) ; 4 4 ; USE OF THE SAVE AND RESTORE FUNCTION a=25 b=10 save, a, b, file='file.sav' a=0 b=0 help,a help,b restore, 'file.sav' help,a help,b ; making macros: just write the commands in a text file and end the file ; with the word END. an example seems not too useful here... ; for examples of programs that have already been written you can peruse ; xdoc and look for simple programs or as Karen pointed out you can ; take a look at trae winter's website from last year. I have taken many ; of my examples from him ; also as Karen pointed out, the xdoc files have a standard header to them ; which is pretty handy, and you may or may not choose to use it for your ; own programs. ; that's all i can think of. Questions are always welcome.