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

Home » Public Forums » archive » Re: IDL FOR Loop variable increments
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: IDL FOR Loop variable increments [message #62608 is a reply to message #62607] Thu, 18 September 2008 15:00 Go to previous messageGo to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
> k=1
> for b=0,8 do begin ; Number of bands
> j=7
> c=b+k
> if b gt 0 and b ne (c) then continue

So, in this case, you go back to the for loop and increase b...
so, you have the first iteration with b=0 (this above statement is not
executed when b=0). Then, you increase b, so 'b gt 0' is true, and 'b ne
c' is also always true... k >= 1, so b+ k will NEVER be equal to b ...
so the above statement is always executed, until b > 8.
Jean


> for k=1, j do begin ; Iterations within bands
> if c lt 7 then begin
> if finite(ndvislice[s,b+k]) eq 1 then begin
> if ndvislice[s,b+k] ge ndvislice[s,b] then begin
> ndvi[s,b+k]=ndvislice[s,b+k]
> break
> endif else begin
> if ndvislice[s,b+k] lt ndvislice[s,b] then begin
> ndvi[s,b+k]=mask[s,r]
> endif
> endelse
> endif else begin
> ndvi[s,b+k]=mask[s,r]
> endelse
> endif
> endfor
> ENDFOR
>
> In the code above, i want b ( the number of bands) to be incremented
> by the value (b+k) instead of standard consistent increments of 1 or
> 2.. So, instead of b progressing from 0 to 8 as 0,1,2,3 etc..i want it
> to iterate based on the value of (b+k) derived out of the inner FOR
> loop (for k=1, j). My results run correctly but those pixels for which
> 'b' needs a (b+k) increment are not recogized by the line "if b gt 0
> and b ne (c) then continue" and so it keeps skipping all 'b'
> iterations. 'c' here is just a variable assigned to the value of b+k.
>
> Where am i going wrong ? Please let me know if you need more
> information.
>
> Thanks,
> Raghu
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: how to countor on YZ-surface
Next Topic: Getting array indices

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

Current Time: Wed Oct 08 17:36:46 PDT 2025

Total time taken to generate the page: 0.00552 seconds