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

Home » Public Forums » archive » Re: Variable undefined after while-cycle?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Variable undefined after while-cycle? [message #26679 is a reply to message #26667] Wed, 19 September 2001 09:28 Go to previous messageGo to previous message
Martin Downing is currently offline  Martin Downing
Messages: 136
Registered: September 1998
Senior Member
I think Pavels solution will always be true as Lasttime is now defined
identical to this time (ie mstime)
try these changes (marked by ;**)#
cheers
Martin

;** add
Lasttime = -1 ; dummy value which should always be different from mstime
;**
while not EOF(lun) do begin
readf, lun, line
line=strjoin(strsplit(line,'"',/extract),/single)
;** delete Lastline here
values=strsplit(line,',',/extract)
msdate=double(values(0))
mstime=double(values(1))
;** modify below so that you dont detect the first loop as changed
if (Lasttime ne -1) and (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
;**
Lasttime = mstime ; now set to mstime ready for next loop
;**
endwhile


--
----------------------------------------
Martin Downing,
Clinical Research Physicist,
Orthopaedic RSA Research Centre,
Woodend Hospital, Aberdeen, AB15 6LS.
Tel. 01224 556055 / 07903901612
Fax. 01224 556662

m.downing@abdn.ac.uk

"Pavel A. Romashkin" <pavel.romashkin@noaa.gov> wrote in message
news:3BA8B32E.9BE43C7B@noaa.gov...
> Olaf Stetzer wrote:
>>
>> while not EOF(lun) do begin
>> readf, lun, line
>> line=strjoin(strsplit(line,'"',/extract),/single)
>> Lasttime=double(values(1))
>
> From the code snippet I see, VALUES[0] is not defined yet. Switch the
> line above with the next line that defines VALUES.
>
>> 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) + '"'
> ...
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Way to determine big/little endian?
Next Topic: Re: Arrow command/ velovect plot resolution

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

Current Time: Tue Oct 21 05:59:51 PDT 2025

Total time taken to generate the page: 0.95972 seconds