restore_idl

Imports variables (scalar, string, array, structure) from IDL save files into Matlab workspace.
2K Downloads
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.
Operation:

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.

Capabilities:
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:

http://www.physics.wisc.edu/~craigm/idl/savefmt/

C. Pelizzari, University of Chicago, October 2013

Cite As

Charles Pelizzari (2024). restore_idl (https://www.mathworks.com/matlabcentral/fileexchange/43899-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
1.14.0.0

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

1.13.0.0

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

1.12.0.0

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.

1.11.0.0

17 Sept 2015: Restored missing checkbox background color

1.10.0.0

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

1.9.0.0

print warning and bail out if file seems to be compressed

1.8.0.0

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

1.7.0.0

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

1.6.0.0

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

1.5.0.0

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

1.2.0.0

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

1.0.0.0