Write matrix to text file

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed Jul 8 02:45:15 CEST 2009

En Tue, 07 Jul 2009 14:46:47 -0300, Hanna Michelsen <hannarosie at gmail.com>  

> I'm working with both python and matlab at the moment and I was  
> wondering if
> there is an efficient way to take a 2-D array (of 1s and 0s) in python  
> and
> write it to a text file such that matlab will be able to create a sparse
> matrix from it later.

Your yesterday post appeared on this list successfully.
Posting the very same text again isn't going to help - those that are  
reading it now are likely the same that read it before.
If nobody replied, assume that something is wrong with the question  
itself. Not the grammar, looks clear to me. Maybe the meaning: you say "a  
2-D array" but you don't say what that means (a list? an array.array  
object? a Numpy array?).

Consider *who* might be able to answer: someone that knows both Python and  
matlab, and knows how to use a sparse matrix, and knows how to read data  
 from files, and knows how to generate such files from Python. The last  
part is the easy part, because people here is supposed to know how to do  
things in Python; but not how matlab works. So, please help people help  
you: tell us what file format would be fine for matlab to read, and people  
here surely will suggest the best way to write that in Python.

Reading http://www.mikeash.com/getting_answers.html may help too.

Gabriel Genellina

More information about the Python-list mailing list