Re: problem restoring a save file from within a procedure [message #44374] |
Thu, 09 June 2005 09:11 |
JD Smith
Messages: 850 Registered: December 1999
|
Senior Member |
|
|
On Thu, 09 Jun 2005 16:53:35 +0200, Benjamin Luethi wrote:
> Hi
>
> The variables are properly restored, but only "inside" the procedure.
> Once you leave the procedure, they are discarded.
>
> To access them you have to either return the variables from the procedure
> (PRO plotprecip, var1, var2, var3) or declare them as global variables
> (COMMON).
Or, pass an argument in of the name of a variable being restored:
pro restore_it, my_var
restore,'my_var.sav'
end
then on return my_var will have been set.
JD
|
|
|
|
Re: problem restoring a save file from within a procedure [message #44382 is a reply to message #44380] |
Thu, 09 June 2005 07:53  |
Benjamin Luethi
Messages: 22 Registered: December 2004
|
Junior Member |
|
|
Hi
The variables are properly restored, but only "inside" the procedure.
Once you leave the procedure, they are discarded.
To access them you have to either return the variables from the procedure
(PRO plotprecip, var1, var2, var3) or declare them as global variables
(COMMON).
Ben
On Thu, 09 Jun 2005 16:43:46 +0200, Hrafnkell
<hrafnkellpalsson@hotmail.com> wrote:
> Hi
>
> My problem is that I can't restore .sav files from within a procedure.
> There are three restore commands whitin my procedure, each one for a
> different .sav file. Each .sav file contains only one variable (none of
> them with the same name). The three restore commands are the only
> commands in the procedure.
> So my procedure looks like this:
>
> PRO plotprecip
> restore, 'fullpath1'
> restore, 'fullpath2'
> restore, 'fullpath3'
> END
>
> When I run the procedure IDL doesn't issue an error command, but the
> variables aren't restored. The variables are deffinately in the .sav
> files because when I restore them from the command line IDL recognizes
> the variable whitin them. The problem seems to be windows. When I ran
> the procedure on a linux machine everything went fine. Is this a known
> bug?
>
> Any help appreciated, Hrafnkell
>
--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
|
|
|