loading Matlab 6 and 7 files
- To: mathgroup at smc.vnet.net
- Subject: [mg75981] loading Matlab 6 and 7 files
- From: grenander <grenander at gmail.com>
- Date: Mon, 14 May 2007 03:46:03 -0400 (EDT)
- Organization: University of California, Berkeley
[It is generally the policy of this group to not discuss non-Mathematica systems, but in this specific case, when this sort of issue also appears on the Wolfram.com web site and has been discussed in the past in this group, it will be permitted - Moderator] I have data saved as .mat files using Matlab v6-7. I would like to work with this data in Matheamtica. I'm wondering what is the best way to do this. Here are some things I have tried just today: 1. Load the .mat files in Matlab 7.3 2006b and save using the -v7.3 option, which saves the data in hdf5 format. It seems this is the save format for Matlab going forward. The file sizes are sometimes twice as large though. Then in Mathematica load using Import[,"HDF5"]. I am not sure yet how to Export multiple SDS data as one HDF5 file in Mathematica yet. This is sparsely documented and I don't know enough about HDF5. It would be nice to able to save any Mathematica data (images, plots, etc) that occur in an .nb this way to be used by other programs. I am guessing this is not possible with the current HDF5 support in Mathematica. 2. Use the mat2hdf command-line converter (google mat2hdf) It doesn't work for some of the Matlab data types. 3. Use scipy.io.loadmat through Pythonika Most of the data types require some manipulation to be passed back with Pythonika. Is there an easier or better way to do this? Is there a native .mat reader and writer for Mathematica for .mat files saved with Matlab > v5. It seems that hdf5 is a good format to work with as it is supported to some extent by both Mathematica and Matlab. Are there any pitfalls, better formats?