I have a mat file that I accessed using
from scipy import io mat = io.loadmat('example.mat')
From matlab, example.mat contains the following structure
>> load example.mat >> data1 data1 = LAT: [53x1 double] LON: [53x1 double] TIME: [53x1 double] units: {3x1 cell} >> data2 data2 = LAT: [100x1 double] LON: [100x1 double] TIME: [100x1 double] units: {3x1 cell}
In Matlab, I can access data as easily as data2.LON, etc. This is not so trivial in python. This gives me several options, although it seems
mat.clear mat.get mat.iteritems mat.keys mat.setdefault mat.viewitems mat.copy mat.has_key mat.iterkeys mat.pop mat.update mat.viewkeys mat.fromkeys mat.items mat.itervalues mat.popitem mat.values mat.viewvalues
Is it possible to keep the same structure in python? If not, what is the best way to access data? The existing Python code that I use is very difficult to work with.
thanks
mikeP
source share