Carlos Medrano wrote:
> Matthew Brett <matthew.brett <at> gmail.com> writes:
>>>> Hi,
>>>>>>> When I try to use io.loadmat it reads numbers as unsigned integers
>>>>>>>>>>>> ret=io.loadmat('datafile.mat')
>>>>>> ret['L1']
>>>>>>>>> array([ 10, 4294966944, 97346], dtype=uint32)
>>>>>>>>> How can I do to read the original data type?
>>>>> This is because matlab saves the data in that format. You could try
>> this hardly documented feature:
>>>> import scipy.io as sio
>> MR = sio.MatFile5Reader(open('datafile.mat'), matlab_compatible=True)
>> ret = MR.get_variables()
>>>> Best,
>>>> Matthew
>>>>>> Hi
>> If I try your code I get the following error:
>>>>> import scipy.io as sio
>>>> MR = sio.MatFile5Reader(open('datafile_v7.mat'), matlab_compatible=True)
>>>>> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> AttributeError: 'module' object has no attribute 'MatFile5Reader'
>> Anyway, you give me a valuable information. If this is caused by the way matlab
> saves the data, this means I was not doing anything wrong. So perhaps the best
> way to solve this kind of problems is to use some other way of saving data in
> matlab (fprintf and friends).
>> Thank you
>> Carlos Medrano
>>>> _______________________________________________
> SciPy-user mailing list
>SciPy-user at scipy.org>http://projects.scipy.org/mailman/listinfo/scipy-user>>>> io.MatFile5Reader
<class 'scipy.io.mio5.MatFile5Reader'>
>>> scipy.__version__
'0.5.2.dev2289'
I guess you need a recent version of scipy.
Nils