Restore IDL Save Files
Updated 3 Apr 2020
NOTE: This is an updated version of my posting "restore_idl" which I can no longer modify since my email address changed. See the comments for that posting to see what users had to say about it. As mentioned below, all issues for which data were made available have been addressed, resulting in more capability to handle the full catalog of data types.
Data exchange between Matlab and IDL is a longstanding challenge. Exporting to an intermediate format (CSV, HDF, etc) often does the job, but reading the native archive files of each language into the other would be much simpler.
"restore_idl_gui" is a Matlab GUI that allows restoring variables from an IDL save file. Variables are restored into the Matlab base workspace. Optionally changes names of created variables to lowercase.
Click "Choose IDL File" - use file browser to identify the IDL save file. Variables in the IDL file will be listed indicating their data type (scalar, array, structure, uint8, float32, etc); and for arrays, their dimensions.
Select one or more variables in the display listbox (shift-click, control-click, etc. for multiple selection)
Choose "Convert names to lowercase" if desired. Variables are saved with names (and structure field names) in ALL CAPS so if you find that annoying, click the handy checkbox (actually it's checked by default because I find it annoying).
Click "Restore Selected" - chosen variables will be created in the base Matlab workspace.
Can process all basic IDL numeric, array, string and structure data types. Does NOT restore object references. Does NOT understand ulong64 offsets, thus cannot process files >4GB.
Structures with fields that are arrays or other structures are handled via recursion. Known to work properly with save files from IDL version 8.1. A number of users have reported problems processing their data files, all of which have been addressed when their data was made available; and the code now knows how to handle IDL heap variables, predefined structures in the save file, and variables with the "inherit from superclass" flag set. IDL "object pointers" are not supported, and since they have no meaning in Matlab they will continue not to be.
Since the file format description used to develop the code is several years old (see link below), probably will work with files from earlier versions as well. Does NOT handle compressed files, i.e. the "/COMPRESS" switch in the SAVE command cannot have been used. This capability will NOT be forthcoming.
Non-GUI version is a function "restore_idl" that takes as input arguments a full pathname for the save file (provides a browser if no valid file specified), and a few other options including "lowercase" and "verbose". Returns all the variables it can understand from the file in one of several ways: by default as a single structure containing all the restored variables as fields; or optionally as an array of structs with two fields: a string "name", and a cell array "value" which contains whatever the variable happens to be; or optionally by creating the variables in the base MATLAB workspace.
Based on description of IDL save file format by Craig Markwardt:
C. Pelizzari, University of Chicago, October 2013 (original)
New version April 2018 with capability to handle more data types
charles pelizzari (2023). Restore IDL Save Files (https://www.mathworks.com/matlabcentral/fileexchange/67085-restore-idl-save-files), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.