[gradsusr] help with while loop

Dimitrios Katsanos katsanos at meteo.noa.gr
Fri Mar 19 09:59:28 EDT 2010


Hello everyone,


I'm trying to create a XY plot (actually a spaghetti plot) using a .txt file as data source.
Part of my script is :

while (1)

ret = read(My.File)

rc = sublin(ret,1)

if (rc>0) 

break

endif

rec = sublin(ret,2)

x = subwrd(rec,1)

y = subwrd(rec,2)

x = 1.0+(x-xmin)*xdif

y = 1.5+(y-ymin)*ydif

i=1

while (i<21)

z.i = subwrd(rec,i+2)

z.i = 1.5+(z.i-ymin)*ydif

k.i=i+21

say x' 'y' 'z.i' 'k.i

if (first) 

'set line 1 1 8'

'draw line 'xold' 'yold' 'x' 'y

'set line 0' 

'draw mark 3 'xold' 'yold' 0.05'

'set line 21'

'draw mark 3 'xold' 'yold' 0.05'

'set line 'k.i' 1 3'

'draw line 'xold' 'oldz.i' 'x' 'z.i

'set line 0' 

'draw mark 3 'xold' 'oldz.i' 0.05'

'set line 'k.i

'draw mark 4 'xold' 'oldz.i' 0.05'

endif

first = 1

xold = x

yold = y

oldz.i = z.i

'set line 0' 

'draw mark 3 'xold' 'yold' 0.05'

'set line 21'

'draw mark 3 'xold' 'yold' 0.05'

'set line 0' 

'draw mark 3 'xold' 'oldz.i' 0.05'

'set line 'k.i

'draw mark 4 'xold' 'oldz.i' 0.05'

i=i+1

endwhile

endwhile

  

But besides the white line ('set line 1 1 8') it only plots the first line ( 'set line 'k.i' 1 3'     defined by i=1, or whatever value I give to i) ignoring the while loop!
Any help it would be much appreciated


Best Regards,
Dimitris












--------------------------------------------------------------------------------------------
Dr. Dimitrios K. Katsanos

--------------------------------------------------------------------------------------------

National Observatory of Athens
Institute for Environmental Research
Lofos Koufou 15236-Penteli
Athens-Greece

T:  +30 210 8109136 
F:  +30 210 8103236
M: +30 697 4598389

http://www.noa.gr/forecast (NOA Weather forecasts in English)
http://www.meteo.gr (NOA Weather forecasts in Greek)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20100319/72e08bc1/attachment-0003.html 


More information about the gradsusr mailing list