Imports variables (scalar, string, array, structure) from IDL save files into Matlab workspace.
Updated 27 Sep 2015

View License

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.
This 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. This structures within structures feature has not been thoroughly tested - only to one level of nesting. Known to work properly with save files from IDL version 8.1. 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.

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 couple other options: "lowercase" and "verbose". Returns all the variables it can understand from the file in an array of structs with two fields: a string "name", and a cell array "value" which contains whatever the variable happens to be.
Based on description of IDL save file format by Craig Markwardt:

C. Pelizzari, University of Chicago, October 2013

Cite As

Charles Pelizzari (2024). restore_idl (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2011b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

Added demo which restores all files in the distribution directory, and creates local Matlab variables to illustrate how.

changed output format of callable function to single struct whose field names are IDL variable names.

Added callable function version "restore_idl" in addition to GUI version "restore_idl_gui" that loads all variables in the save file into an array of structs.

17 Sept 2015: Restored missing checkbox background color

April 2015: fixed logic for structures containing arrays of structures. Added restore debug output option.

print warning and bail out if file seems to be compressed

Corrected logic for arrays of structures and processing of variables which contain null strings

Feb 2015: add code for string array processing; fix logic for zero length strings if found in save file.

31 Jan 2014 - fixed problem with improper handling of array start codes within structures that caused incorrect results for structure containing multiple arrays.

Save path of previously chosen file as default for next one.

Adjusted GUI font sizes to play well on both Mac and Windows