; IDL Version 5.3 (OSF alpha) ; Journal File for hahn@mithra.physics.montana.edu ; Working directory: /home/hahn ; Date: Fri Jun 11 14:15:31 2004 print, 1 gt -1 ; 1 ; I thought i'd add an example of saying an array is greater than another print, [1,2,3,4] gt [2,1,4,3] ; 0 1 0 1 ; LOOPS FOR i=0,10 do print, cos(((2*!pi)/10*i) ; % Syntax error. FOR i=0,10 do print, cos(((2*!pi)/10*i)) ; 1.00000 ; 0.809017 ; 0.309017 ; -0.309017 ; -0.809017 ; -1.00000 ; -0.809017 ; -0.309017 ; 0.309017 ; 0.809017 ; 1.00000 x=20 y=8 while x gt y do x=x-5 print,x ; 5 x=20 y=8 repeat x=x-5 until x lt y print,x ; 5 ; boolean operators are mostly covered on the slides print, (1 lt 3) and not (1 gt 5) ; 1 print, (1 lt 3) and (1 gt 5) ; 0 ; opening files openr,lun, text.txt,/get_lun ; % Expression must be a structure in this context: TEXT. openr,lun, 'text.txt',/get_lun openr, lun, '/home/hahn/IDL_STUFF/example.pro',/get_lun print, lun ; 102 ; note that text .txt was in my home directory, but example.pro was not openr, lun, 'example.pro',/get_lun ; % OPENR: Error opening file. Unit: 103, File: example.pro ; No such file or directory s='i am glad today is friday' print, s ;i am glad today is friday print,s, Format='(A6) ;i am g print,s, Format='(A46) ; i am glad today is friday ; here are some better examples of using the format keyword x=1000000000000 help,x x=double(1000000000000) help,x ;X DOUBLE = 1.0000000e+12 print,x, FORMAT='(1D4.5)' ;**** print,x, FORMAT='(1D25.5)' ; 1000000000000.00000 ; the problem was that I only allowed for a number with a total of 4 ; digits, but the number x has more than that so rather than figure out ; how to round IDL printed all ***'s print,x, format='(1e25.3)' ; 1.000e+12 print, 6.40, format='(1d3.2)' ;*** print, 6.40, format='(1d4.2)' ;6.40 print, 6.40, format='(1d5.2)' ; 6.40 ; 1d3.2 didn't work because the decimal point counts print, 6.40, format='(1f0)' ;6.400000 print, 26.40, format='(1f0)' ;26.400000 ; Anyway, format is mostly useful for reading and writing formatted input ; and output, if you want to do that you can read plenty about it in the ; help menu. ; I also used that program extract_text.pro which you can look at and try ; to see how everything there works. ; always, I'll answer any questions you may have, even the ones about ; format but they might take me a little longer...