I’m trying to load a MAT file that is a cell array of structs. Each of those structs have many fields, some of which are themselves cells.
A typical call would be:
myCell{1}.myStructField{1}.myStructField
How do I load such a nested structure into Python?
Thanks for your thoughts.
scipy.io.loadmatwill load the mat file if it’s pre-v7.3; you can then access it likematfile['myCell'][0]['myStructField'][0]['myStructField'].If it’s v7.3 or higher, you can use
h5py; after opening it, I think it’ll also bef['myCell'][0]['myStructField'][0]['myStructField'], though you’ll need to worry about possibly transposing the matrices because of column-major / row-major differences.