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

Home » Public Forums » archive » Re: weird behaviour with cgdemodata
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: weird behaviour with cgdemodata [message #76619 is a reply to message #76618] Tue, 21 June 2011 08:27 Go to previous messageGo to previous message
ben.bighair is currently offline  ben.bighair
Messages: 221
Registered: April 2007
Senior Member
Hi,


On 6/21/11 10:26 AM, Jeremy Bailin wrote:
> I'm sure there's a good reason why this happens, but it has me very confused:
>
> IDL> i = 5
> IDL> print, i, n_elements(cgdemodata(i))
> 4 65536
>
> Okay, that looks fine. Now what if I put that in a for loop?
>
>
> IDL> for i=0,5 do print, i, n_elements(cgdemodata(i))
> 0 101
> 0 101
> 0 101
> 0 101
> 0 101
> 0 101
> 0 101
> 0 101
> 0 101
> 0 101
> 0 101
> 0 101
> 0 101
> 0 101
> 0 101
> 0 101
> ...repeat ad infinutm, i.e. until you hit Ctrl-C
>
>
> What is going on???
>
> -Jeremy.

It looks like David overwrites the positional argument "number" in his
code - which you pass in as "i". "i" keeps getting reset to 0 in the
loop. It's the old pass-by-reference thing. I have posted a fix here...

http://dl.dropbox.com/u/8433654/cgdemodata.pro


but I'll send it along to David so he can decide what to do for the long
run.

Cheers,
Ben
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Composite images
Next Topic: IDL IMAGE NAVIGATION

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

Current Time: Wed Oct 08 20:04:30 PDT 2025

Total time taken to generate the page: 0.00414 seconds