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

Home » Public Forums » archive » Re: Need Help Resolving ENDIF Errors
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: Need Help Resolving ENDIF Errors [message #65536 is a reply to message #65535] Tue, 10 March 2009 14:21 Go to previous messageGo to previous message
ben.bighair is currently offline  ben.bighair
Messages: 221
Registered: April 2007
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



Hi,

Do you really mean where(XX ne XX)? XX ne XX should give you and
array the size of XX filled with zeroes.

IDL> xx = INDGEN(10)
IDL> print, xx ne xx
0 0 0 0 0 0 0 0 0 0

I have no idea how to resolve the endif error or if the above is
related. However, in general (regardless of the comparison you are
making) you want to do the WHERE search just once.

index = WHERE(something NE somethingElse, count)
if (count NE 0) then begin

aThirdThing = ZZ[index]

endif

No point in searching your array repeatedly if you don't need to.

Ben
[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
Previous Topic: Re: using irregularly spaced coordinates with ray-casting in iVolume
Next Topic: OpenADDE and IDL

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

Current Time: Wed Oct 08 19:25:14 PDT 2025

Total time taken to generate the page: 0.00472 seconds