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

Home » Public Forums » archive » Re: is this a bug in IDL?
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: is this a bug in IDL? [message #37377 is a reply to message #37376] Tue, 16 December 2003 03:09 Go to previous messageGo to previous message
Ben Panter is currently offline  Ben Panter
Messages: 102
Registered: July 2003
Senior Member
Aramis Martinez wrote:
> k=0
> for i=0,8759 do begin
> x=vbs(2,i)
> if x gt 0.0 then k=k+1 & x=0 & vbs(2,i)=x
> endfor
> print, k
>
> k=0
> for i=0,8759 do begin
> x=vbs(2,i)
> ;; version A
> if x gt 0.0 then x=0 & k=k+1 & vbs(2,i)=x
> ;; version B
> if x gt 0.0 then k=k+1 & x=0 & vbs(2,i)=x
> endfor
> print, k
>

I'm no expert, but I think that possibly your code is using & in the
wrong way - as far as I understand it (correct me if I'm wrong guys!!) &
means "complete the previous command then do the thing after me" - so
your code actually reads:

k=0
for i=0,8759 do begin
x=vbs(2,i)
if x gt 0.0 then x=0
k=k+1
vbs(2,i)=x
endfor

or

k=0
for i=0,8759 do begin
x=vbs(2,i)
if x gt 0.0 then k=k+1
x=0
vbs(2,i)=x
endfor

To get the behaviour that you want I think you need another begin...end set:

k=0
for i=0,8759 do begin
x=vbs(2,i)
if x gt 0.0 then begin
k=k+1
x=0
vbs(2,i)=x
end
endfor


--
Ben Panter, Edinburgh
My name (no spaces)@bigfoot which is a com.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Linux Colour Display problems
Next Topic: How to make IDL be quiet

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

Current Time: Sun Oct 12 05:49:07 PDT 2025

Total time taken to generate the page: 1.11977 seconds