Unable to open scipy.io.savemat mat file
Jonathan Stickel
jjstickel at vcn.com
Wed Jul 8 08:45:20 CDT 2009
On 7/8/09 bug-octave-request at octave.org wrote:
> Dickon Humphrey wrote:
>> > Bug report for Octave 3.2.0 configured for i686-pc-mingw32
>> >
>> > Description:
>> > -----------
>> >
>> > Octave will not open a mat file saved using scipy.io.savemat. I
>> > believe the version of scipy used is 0.7.0, which has recently been
>> > reworked. The release notes for scipy 0.7.0 state:
>> > The Matlab (TM) file readers/writers have a number of improvements:
>> >
>> > * default version 5
>> > * v5 writers for structures, cell arrays, and objects
>> > * v5 readers/writers for function handles and 64-bit integers
>> > * new struct_as_record keyword argument to ``loadmat``, which loads
>> > struct arrays in matlab as record arrays in numpy
>> > * string arrays have ``dtype='U...'`` instead of ``dtype=object``
>> >
>> > The error I get when opening the attached file is:
>> >
>>> >> load D66_TH_Dcr2_POLG-RNAi-A2_small.mat
>> > error: unable to resize object to fewer than 2 dimensions
>> >
>> > The code that produces the mat file is the 'WriteMAT' function in the
>> > attached python file from an application called Ctrax
>> > (http://developer.berlios.de/projects/ctrax/ ).
>> >
>
> I doubt this file loads in matlab either. Scalars and vectors in matlab
> and octave have 2 dimension and thus the error.. See
>
> octave:1> ndims (1)
> ans = 2
> octave:2> ndims (ones(1,5))
> ans = 2
>
> If the claim of scipy is compatibility with matlab then the mat-files
> saved by scipy should always save scalars and vectors with 2 dimensions,
> so I'd say report the bug to scipy. If scipy does want to do any thing
> about it, then and only then a workaround in octave should be contemplated
I've recently had success transfering data the other way, octave ->
numpy/scipy, using hdf5 as the file format. Have you considered trying
hdf5 instead of mat?
Jonathan
More information about the Bug-octave
mailing list