The SAVE and RESTORE procedures and the IDL_Savefile object combine to provide the ability to save the state of variables and system variables to restore them at a later time. Variables that are used from session to session can be saved as and recovered from a SAVE file. A startup file can be set up to execute the RESTORE command every time IDL is started. (See Startup Files for information on specifying a startup files.) For an overview of how to restore and run SAVE files, see Executing Programs Stored in a SAVE File.
The state of variables in an IDL session can be saved quickly and easily, and can be restored to the same point. This feature allows you to stop work, and later resume at a convenient time. Variables that you may wish to create a SAVE file of include frequently used data files or system variable definitions.
Data can be conveniently stored in SAVE files, relieving the user of the need to remember the dimensions of arrays and other details. It is very convenient to store images this way. For instance, if the three variables R, G, and B hold the color table vectors, and the variable I holds the image variable, the IDL statement,
SAVE, FILENAME = 'image.sav', R, G, B, I
will save everything required to display the image properly in a file named
image.sav. At a later date, the simple command,
will recover the four variables from the file.
System variables can also be saved and later applied to another session of IDL. For instance, you may choose to customize
To save and restore the state of all current and system variables within an IDL session, you could use the following statement:
SAVE, /ALL, FILENAME = 'myIDLsession.sav'
The ALL keyword saves all common blocks, system variables and local variables from the current IDL session. See Constants and Variables for information on these elements of an IDL session.
To restore the session information, enter:
Long iterative jobs can save their partial results in a SAVE format to guard against losing data if some unexpected event such as a machine crash should occur.
.profiles and re-create the SAVE file using the current version of IDL.