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

Home » Public Forums » archive » do I need this IF statement?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
do I need this IF statement? [message #43247] Thu, 24 March 2005 02:07 Go to previous message
Margrethe is currently offline  Margrethe
Messages: 4
Registered: March 2005
Junior Member
I find that in some cases I really need an IF statement to make sure
that I don't address some arrays with index -1. In the example below I
have vectorized the inner loop over j, but have kept the loop over i.
Is there a way to avoid the IF statement? Grateful for help! -Margrethe

FOR i=0,N-1 DO BEGIN

d = sqrt ( x(i) ^2 + y (INDGEN(N)) ^2 )
indx = WHERE ( d LT 3.*sigma, ct )

IF (ct GT 0) THEN BEGIN

v = v1 + vr (i,indx)
p = some_function ( x(i), y(indx) )
profile = profile + TOTAL ( p * image(i,indx) )

ENDIF

ENDFOR
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Displaying floating point values with user specified decimal places?
Next Topic: Great News Blog!

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

Current Time: Wed Oct 15 15:28:24 PDT 2025

Total time taken to generate the page: 0.48516 seconds