Re: Need Help Resolving ENDIF Errors [message #65618 is a reply to message #65537] |
Wed, 11 March 2009 08:19   |
Jeremy Bailin
Messages: 618 Registered: April 2008
|
Senior Member |
|
|
On Mar 10, 4:41 pm, einszweil...@gmail.com wrote:
> On Mar 10, 3:38 pm, einszweil...@gmail.com wrote:
>
>
>
>> I'm trying to run a procedure in IDL. The procedure has a series of
>> IF LOOPS, each of minimal complexity - they are fairly simple.
>
>> For example:
>
>> XX=readfits('/home/kphil/img/img213.fits')
>> YY=readfits('/home/kphil/img/img213.fits', EXTEN_NO=1)
>> ZZ =YY
>
>> G = where(ZZ ne 0)
>> invarmap= ZZ * 0.0
>> invarmap[G] = (1./(ZZ[G])^2)
>
>> if ((where(XX ne XX))(0) ne -1) then begin
>> ZZ[where(XX ne XX)] = 0
>> XX[where(XX ne XX)] = 0
>> endif
>
>> The problem is that everything runs just great, until the ENDIF is
>> reached. I CONSTANTLY get ENDIF errors.
>
>> Why is this happening? I feel that my code is solid, but all I get
>> are ENDIF errors.
>
>> The .pro I'm running has about 7 IF LOOPS, and the ONLY errors I get
>> are on the lines where ENDIF is.
>
>> Any idea what the problem is? Help!
>
>> Thanks in advance.
>
> For clarity the error message always looks something like:
>
> endif
> ^
> % Syntax error.
> At: /home/kphil/idl/pro/cltin.pro, Line 37
>
> Ugh...
My votes:
1. Yes, there is a use of asking where(XX ne XX) - it tells you where
there are NaNs. I use it all the time.
2. Definitely take Ben's advice about only having one WHERE!!!
3. I think Andi's speculation is the right one... you're probably
using @foo.pro instead of .run foo.pro.
-Jeremy.
|
|
|