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 #62612 is a reply to message #62609] Thu, 18 September 2008 13:23 Go to previous messageGo to previous message
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
Raghu wrote:
> Hi all,
>
> I'm having a problem with FOR loop increments in IDL which i'm not
> able to fix. I have pasted the code and a small description about it
> follows.
> k=1
> for b=0,8 do begin ; Number of bands
> j=7
> c=b+k
k here is going to be equal 1 for the first iteration, and equal j
afterwards

Paolo

> if b gt 0 and b ne (c) then continue
> 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: Fri Oct 10 06:58:58 PDT 2025

Total time taken to generate the page: 1.60141 seconds