[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Read and Write IDL SAVE files!

"Christopher W. O'Dell" <odell@cmb.physics.wisc.edu> writes:

> Craig,
> Your library looks GREAT.  I'm still using v5.2, however, and your CMRESTORE
> routine had some problems restoring
> a file written with SAVE (v5.2), giving the following error for each variable
> in the file:
> %CMRESTORE: WARNING: could not create variable QFINALMAP in calling routine.
> ...
> However, when i do
> idl> CMRESTORE, filename, qfinalmap
> it restorest that variable just fine.  Any ideas?

Yes, you really have two choices:

 * upgrade to IDL 5.3, or;
 * define the variables before you call CMRESTORE.

Before IDL 5.3, there was no programmatic way to *create* a variable
at the caller's level, but you can modify an existing one.

When you type,

   CMRESTORE, filename, qfinalmap

you are passing by argument, which is something completely different.
The values are returned by argument, so CMRESTORE doesn't have to try
to deposit them in the caller's level.  This should proceed without a

I should note that it doesn't matter *how* you define the variable, or
even that you give it a defined value!  As long as it exists as a
named variable you should be fine.

This leads me to my recommended procedures:

 * if you are simply trying to restore all the variables, go ahead and
   use RESTORE.

 * if you want to restore selected variables, then use one of these:
   CMRESTORE, filename, qfinalmap      ; or
   CMRESTORE, x0, x1, names=['filename', 'qfinalmap']

 * if you are writing a program then there are some other helpful ways
   to exchange data, using either pointers, or a structure.

Have fun Chris!

Craig B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response