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

Home » Public Forums » archive » Re: regarding scope of variables
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: regarding scope of variables [message #46510 is a reply to message #46509] Fri, 25 November 2005 20:42 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
IDLmastertobe writes:

> Hi, I have an array of data and I am trying to keep a copy of it so that i
> can restore the origianl data after certain operations. however I found
> everytime it reiterates the function, the variable that keeps the copy
> would go out of scope and my copy is gone. following is part of my code:
>
> if(size(ydata, /n_dimensions) eq 3) then begin
> if(!firsty eq 1) then begin
> yarr = ydata
> !firsty=0
> endif
> ydata = smooth(yarr, [1, !smo, !smo])
> oyimage->SetProperty, data = ydata
> endif
>
> however, the second time when this code is called, the yarr variable
> becomes undefined since it goes out of scope. What it copied in the first
> time is gone. Since I have no information on the size of the array i'm
> copying, i cannot preset an array as system variable to run. Does anyone
> have any idea?

I have a hunch "variable scope" is not your real problem here.
I already see two more system variables in these few lines of
code than I've ever used in an IDL procedure. :-)

Is the real problem that you can't figure out how to pass around
data in a widget program? Have you thought about using pointers?

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: iMap & contouring question
Next Topic: Pointer Type Question

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

Current Time: Mon Dec 01 15:07:30 PST 2025

Total time taken to generate the page: 0.40328 seconds