[SciPy-User] scipy.io.loadmat error when trying to read a .mat file
Dharhas Pothina
Dharhas.Pothina@twdb.state.tx...
Wed Oct 6 08:36:40 CDT 2010
fun fun fun. I can't see the second 'System' variable in Matlab R14. Also, from what I could tell the 4 duplicate Summary.StationQ arrays contain different data. The Summary.Units array that contains the units for each variable in summary only has a single Summary.Units.Station_Q value = m3/s. So I still think the duplicates are a mistake. I let you know what I find out from the manufacturer when I'm able to get a hold of them.
In the meanwhile is there a work around to load the rest of the data file into scipy. The duplicate variables that are causing the problems are not ones I need for my analysis. Is it possible from a technical point of view to mimic the matlab load command that lets you specify which variables to load:
Examples for pattern matching:
load fname a* % Load variables starting with "a"
load fname -regexp ^b\d{3}$ % Load variables starting with "b" and
% followed by 3 digits
load fname -regexp \d % Load variables containing any digits
i.e. something along the lines of
scipy.io.loadmat(fname, return_vars='BottomTrack, GPS, Station')
Of course this would require knowing what the field names where. So to be completely independent from matlab we would need a helper function that just returned the names of variables contained in the .mat file.
i.e. something like
scipy.io.loadmat(fname, return_headers=True)
where the result would be a list of variable names.
- dharhas
>>> Matthew Brett <matthew.brett@gmail.com> 10/5/2010 8:13 PM >>>
Hi,
> Yes, I'm sure it's an error, but I suppose we should set ourselves the
> goal of being able to read what matlab can read.
You will be pleased to know that, on further investigation, there are
also two 'System' variables in the file. You only see the second when
you read it into Matlab. The first has fields:
('SerialNumber',
'FirmwareVersion',
'FirmwareRevision',
'Frequency',
'InstrumentMatrix_0',
'InstrumentMatrix_1',
'InstrumentMatrix_2')
It's a fun file ;)
Matthew
_______________________________________________
SciPy-User mailing list
SciPy-User@scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user
More information about the SciPy-User
mailing list