[Scipy-tickets] [SciPy] #1606: large array causes savemat to produce a "corrupt" file

SciPy Trac scipy-tickets@scipy....
Wed Feb 22 12:32:06 CST 2012

#1606: large array causes savemat to produce a  "corrupt" file
 Reporter:  david.warde-farley  |       Owner:  somebody   
     Type:  defect              |      Status:  new        
 Priority:  normal              |   Milestone:  Unscheduled
Component:  scipy.io            |     Version:  0.9.0      
 Keywords:  matlab, savemat     |  
Changes (by warren.weckesser):

  * keywords:  matlab => matlab, savemat


 Replying to [ticket:1606 david.warde-farley]:
 > This smells like it may be a deficiency in the MATLAB v5 format itself,
 but if so this save should not ostensibly succeed on the Python end.

 I think you are right.  According to
 www.mathworks.com/help/pdf_doc/matlab/matfile_format.pdf, the header for
 each data element includes the number of bytes in the element, and this
 value is stored in a 32 bit field.  The number of bytes in your array
 exceeds 2**32-1.

 If this is, in fact, the problem, savemat should raise an exception when
 the number of bytes in an array won't find in a 32 bit integer.

Ticket URL: <http://projects.scipy.org/scipy/ticket/1606#comment:1>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.

More information about the Scipy-tickets mailing list