Variable undefined after while-cycle? [message #26685] |
Wed, 19 September 2001 04:16 |
Olaf Stetzer
Messages: 39 Registered: September 2001
|
Member |
|
|
Hello,
I have a strange problem which may be related to the
way IDL frees varaibles in/after subroutines. In the
following example I want to compare a value with the
one from the last while-cycle, however the Variable
to store the Value for the next cycle (Lasttime)
seems to be empty even at the end of the cycle
(at point ;;;XX). When I define the Variable Lasttime
before the while not EOF.... then the behaviour is
still the same, the comparison (Lasttime ne mstime)
is always true, even if it should not!
Thanks,
Olaf
----------------
while not EOF(lun) do begin
readf, lun, line
line=strjoin(strsplit(line,'"',/extract),/single)
Lasttime=double(values(1))
values=strsplit(line,',',/extract)
msdate=double(values(0))
mstime=double(values(1))
if (Lasttime ne mstime) then begin
print,'', Lasttime, mstime, ' Zeiten sind ungleich!'
Zeitpunkt=mstime2sqlts(msdate,mstime)
insertstr='INSERT INTO ' + table + ' VALUES ("' +
sqlts2datetimestr(Zeitpunkt) + '"'
for i=2,(n_elements(fields)-1) do insertstr=insertstr + ', ' +
values(i)
insertstr=insertstr+ ' ) ;'
;;;XX
;dbobj->ExecuteSQL,insertstr
endif else begin
print,'', Lasttime, mstime, ' Zeiten sind gleich!'
endelse
endwhile
--
Dr. Olaf Stetzer
Forschungszentrum Karlsruhe
Institut f�r Meterologie und Klimaforschung
Atmosph�rische Aerosole (IMK III) - http://imk-aida.fzk.de
Tel.: +49(0)7247-82-3249 (FAX: -4332)
|
|
|