Is there any way to create .mat v7.3 files from Python? I have been managed to create hdf5 files from Python but not in converting them into .mat v7.3 files. I found a package called hdf5storage but I don't know how to use it.
Example (requires Python >= 2.6 with the NumPy and h5py >= 2.1 packages):
import hdf5storage # get code on https://pypi.python.org/pypi/hdf5storage/0.1.3
matcontent = {}
matcontent[u'some_numbers'] = [10, 50, 20] # each key must be a unicode string
hdf5storage.write(matcontent, '.', 'test.mat', store_python_metadata=False, matlab_compatible=True)
In Matlab:

If you want to have a matrix instead of a cell array in Matlab:
import hdf5storage # get code on https://pypi.python.org/pypi/hdf5storage/0.1.3
import numpy as np
matcontent = {}
matcontent[u'some_numbers'] = np.array([10, 50, 20]) # each key must be a unicode string
hdf5storage.write(matcontent, '.', 'test2.mat', matlab_compatible=True)

As you will notice, the second example is much faster (>x10).
More generally, refer to the documentation for the data storage matching:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With