scipy.io.loadmat for Matlab 7.3
See original GitHub issueIs your feature request related to a problem? Please describe.
Currently, scipy
is unable to load MATLAB files that are saved with the new MATLAB file format.
Attempting to load them will raise an
NotImplementedError: Please use HDF reader for matlab v7.3 files
Describe the solution you’d like
I’ve implemented a small library that can also load MATLAB 7.3
https://github.com/skjerns/mat7.3 , using h5py
.
It will load all data with the indicated MATLAB datatype into a dict, so similar to scipy.io.loadmat
.
Do you think it makes sense to integrate this directly into scipy?
Describe alternatives you’ve considered
Just leaving it as it is might be actually okay, as adding it would introduce a dependency on h5py
(which is not a dependency of scipy afaik?). what do you think?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:11 (11 by maintainers)
Top Results From Across the Web
reading v 7.3 mat file in python
The files can be opened, sure, but with scipy.io.loadmat the file is represented in transparent data structures (namely, dictionaries and numpy arrays). The ......
Read more >scipy.io.loadmat — SciPy v1.9.3 Manual
Returns matrices as would be loaded by MATLAB (implies squeeze_me=False, chars_as_strings=False, mat_dtype=True, struct_as_record=True). struct_as_recordbool, ...
Read more >mat73
Load MATLAB .mat 7.3 into Python native data types (via h5/hd5/hdf5/h5py) ... This means they cannot be loaded by scipy.io.loadmat any longer and...
Read more >unable to load mat file which was saved in python as ...
I have a mat file which was created in python using savemat at version 7.3. The data is perfectly loading in matlab version...
Read more >scipy.io.loadmat — SciPy v0.8.dev Reference Guide (DRAFT)
scipy.io.loadmat¶ ... v4 (Level 1.0), v6 and v7 to 7.2 matfiles are supported. You will need an HDF5 python library to read matlab...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I don’t think we should add the h5py dependency unconditionally, but it could work as an optional dependency, so it gives an error message when h5py is not installed, suggesting the user install it.
The output should be consistent with the current output for other
.mat
files, unless there’s a good reason for that not to be true.Retaining backward compatibility is a constraint in additions, though. Adding new loading options, and changing behavior in previously undefined cases is generally easy, otherwise painful as how to do the transition needs to be planned and justified.