[SciPy-user] Matlab IO problem? (was: Best way to save ND-arrays for Matlab?)

Zachary Pincus zachary.pincus at yale.edu
Mon Jul 28 12:00:17 EDT 2008


Hello all,

I have investigated my issue with matlab IO a little more. Clearly, I  
need to be using matlab version-5 .mat files, which support  
multidimensional arrays.

I had thought I needed to use version-4 files, because a user said  
that they couldn't read the version-5 ones. However, on closer  
investigation, they are using Version 6.5.0.180913a Release 13 of  
Matlab -- which should be able to read version-5 .mat files fine.

It appears that scipy.io.matlab saves version-5 .mat files which  
cannot always be opened by this version of matlab. I can't quite  
figure out when things work.

scipy.io.matlab.mio.savemat('test', {'five':5}, format='5')
or
scipy.io.matlab.mio.savemat('test', {'five':5*numpy.ones((5,5))},  
format='5')

both fail as below:
 >> load test
??? Error using ==> load
Can't read file.

However, some more complex .mat files, with multiple variables, seem  
to work. Other more-complex ones fail.

Anyone have any thoughts?

Zach




On Jul 28, 2008, at 10:25 AM, Zachary Pincus wrote:

> Hi all,
>
> I'm trying to use the scipy.io.mio tools to write out some arrays for
> matlab users. This works quite well, with the exception of some 3D
> arrays that I have, which (as per the documentation) get flattened to
> 2D during the process. (I'm saving to version 4 .mat files, which I
> need for compatibility with some folk's versions of Matlab.)
>
> Is there any good way to save this data in a less-awkward format for
> the eventual users? Or is this a limitation of the format?
>
> Thanks,
>
> Zachary Pincus
> Postdoctoral Fellow, lab of Frank Slack
> Molecular, Cellular and Developmental Biology
> Yale University
>
>
>
>
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user




More information about the SciPy-User mailing list