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

Lars Voxen Hansen lars@voxdahl....
Wed Oct 10 10:32:51 CDT 2007


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')

------------------


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


More information about the Scipy-dev mailing list