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

Home » Public Forums » archive » Having trouble stopping a loop (or loop de loop de loop)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Having trouble stopping a loop (or loop de loop de loop) [message #62163] Mon, 25 August 2008 19:59
mbweller is currently offline  mbweller
Messages: 24
Registered: July 2008
Junior Member
Hi again everyone,

Here is my rather clunky code (and I know it is rather inefficient):

------------------------------------------------------------ ------------------------------------------------------------ ------
while e_t lt 2 do begin
for x=4e003, 20e003, 4e003 do begin
for c=0.006, 0.01, 0.004 do begin
for o=(50*!pi/180), (70*!pi/180), (10*!pi/180) do begin
v= (a*x)
ind_small = where(file[1,*] lt 2*x,count)
if count eq 0 then te_small=0
if count gt 0 then begin
ext_small = file[*,ind_small]
le_small= ext_small[1,*]
te_small = total(le_small^3)
endif

ind_large = where(file[1,*] ge 2*x,count)
if count eq 0 then te_large=0
if count gt 0 then begin
ext_large = file[*,ind_large]
le_large= ext_large[1,*]
te_large = total(le_large)
endif

kns=(sin(o)*cos(o)/v)
knl=(c*cos(o)*x/a/sin(o))

ens= (kns*c/u)*te_small
enl= knl*te_large
e_t= ens+enl
print,x,c,o,e_t
if e_t ge 0.45 && e_t le 0.9 then openw,1,'g:\Mars_tectonics
\IDL_programs\paper_m_data\alba_eflank.txt',
printf,1,x,c,o,e_t,format='(3f9.3)'
close, 1
endfor
endfor
endfor
endwhile
------------------------------------------------------------ ------------------------------------------------------------ ------
I have a few issues here that i could use some advice for:

1.) I'm not sure how to start and more importantly, end this loop. I
chose: while e_t lt 2 do begin to start it. The problem is that this
loop will never be greater than 2 so it will never end and it just
keeps repeating values ad nauseum in the output file.

I don't want it repeating but I'm not certain how to start it and stop
it to allow for no repeated values.

2.) for for c=0.006, 0.01, 0.004 do begin, I watch the output, but I
don't see it change.

3.) i must of screwed something up in this segment:
if e_t ge 0.45 && e_t le 0.9 then openw,1,'g:\Mars_tectonics
\IDL_programs\paper_m_data\alba_eflank.txt',
printf,1,x,c,o,e_t,format='(3f9.3)'

because it worked before, but know I keep getting an error about
unable to close 1, or somesuch thing (just switched to compilation
error).

As always, I appreciate any help that you may provide. After all I
wouldn't be asking this question if it weren't for all your help :)

Thanks,
~Matt
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Problem with Polar_contour
Next Topic: Re: Where is my function called

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

Current Time: Wed Oct 08 19:37:08 PDT 2025

Total time taken to generate the page: 0.00566 seconds