[SciPy-dev] Saving in MATLAB Level 5 MAT-File Format

Lars Voxen Hansen lars@voxdahl....
Wed Oct 10 15:05:09 CDT 2007


Sorry Matthew,

I made the mistake to do some last corrections to the file just be  
posting. I changed all tabs to spaces, it resulted in some  
indentation errors.

I hope I have not wasted you time dealing with this. A new file is  
attached.

Lars
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mio5.py
Type: text/x-python-script
Size: 28133 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-dev/attachments/20071010/4034db4e/attachment-0001.bin 
-------------- next part --------------

> d = io.load('test.mat','rb')


Den 10/10/2007 kl. 17.42 skrev Matthew Brett:

> Excellent - thank you.  I will have a look and put it into mio soon,
>
> Matthew
>
> On 10/10/07, Lars Voxen Hansen <lars@voxdahl.com> wrote:
>> I need to save in Matlab Level 5 MAT-File Format. The reson is that
>> level 4 only support matrices (2d arrays), I also need to save some
>> 3d arrays and load them into matlab.
>>
>> I have modified mio5.py in ./scipy/io such that this is posible now
>> (see example below). The modified file mio5.py is attached to this
>> mail. I have tested this on windows XP and mac OS X, where it works
>> for me.
>>
>> Is it posible that this modification can be included in scipy?
>>
>> Best Regards and thanks for developing scipy
>> Lars Voxen Hansen
>>
>>
>> example:
>> ----------------
>>
>> import numpy as N
>> from scipy import io
>>
>> A = N.ones((10,20,30))
>> f = open('test.mat','wb')
>> MW = io.mio5.MatFile5Writer 
>> (f,do_compression=True,unicode_strings=True)
>> MW.put_variables({'A1':A,'A2':A+1j*A,'s1':'string1','s2':u'string2'})
>> f.close()
>>
>> d = io.load('test.mat','rb')
>>
>> ------------------
>>
>>
>>
>> _______________________________________________
>> Scipy-dev mailing list
>> Scipy-dev@scipy.org
>> http://projects.scipy.org/mailman/listinfo/scipy-dev
>>
>>
>>
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-dev



More information about the Scipy-dev mailing list