regarding scope of variables [message #46512] |
Fri, 25 November 2005 19:33 |
IDLmastertobe
Messages: 54 Registered: June 2004
|
Member |
|
|
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? Thanks.
|
|
|