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

Home » Public Forums » archive » Re: Setting values in an array without usings loops
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: Setting values in an array without usings loops [message #35869] Fri, 25 July 2003 08:35 Go to previous message
R.G. Stockwell is currently offline  R.G. Stockwell
Messages: 363
Registered: July 1999
Senior Member
"Nancy W. Pearson" <pearson@elbereth.uchicago.edu> wrote in message
news:bfrfuj$ppd$1@bob.news.rcn.net...
> Johan Marais wrote:
>> I want to create a circle consisting out of ones but without the use of
for
>> loops. here is how I do it with the loops. Anyone that can help?
>>
>> r = 33
>> mask = intarr(2*r,2*r)
>> for m=0,2*r-1 do begin
>> for n=0,2*r-1 do begin
>> if ((m-r)^2 + (n-r)^2) gt r^2 then mask[m,n] = 1
>> endfor
>> endfor
>
> IDL> m = shift(dist(2*r),r,r) gt r


Wheeet! Illegal use of hidden "for loop"! 10 yard penalty and loss of
down.
:)


function dist....
for i=0L, m1/2 do begin ;Row loop
y = sqrt(x + i^2.) ;Euclidian distance
a[0,i] = y ;Insert the row
if i ne 0 then a[0, m1-i] = y ;Symmetrical
endfor


Cheers,
bob


PS
yeah, i suppose every array function has a "hidden for loop" if you look
deep enough.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: How to detect edge of an image in IDL?
Next Topic: Online manual

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

Current Time: Fri Oct 10 12:50:32 PDT 2025

Total time taken to generate the page: 0.24067 seconds