Forum Archive

How to load '*.mat' file?

Han JH

Hi guys.

Can I load mat file(matlab matrix file extension)?

Usually people use scipy module, but scipy cannot use Pythonista 3, right?

so, I just wonder there is any other option for loading mat file.

JonB

Which version?

Apparently version 7.3+ .mat files are just hdf, so likely could be read with something like https://github.com/jjhelmus/pyfive

If memory serves, versions older than v7 did not have compression, so we relatively straightforward to decode, are least for simple matrix types.

Han JH

Thank you for your advice.
Fortunately my mat file is 7.3+.
But I don't know how can I use hdf module in "Pythonista".
May I know example code?

Han JH

@JonB Thank you for your advice.
Fortunately my mat file is 7.3+.
But I don't know how can I use hdf module in "Pythonista".
May I know example code?

[deleted]

Mat4py works for me pip install mat4py in Stash
But it has a number of limitations

Han JH

@dancergraham Thanks. I install mat4py using Stash :)