On Fri, Jul 17, 2009 at 11:06 AM, Hanna Michelsen<hannaro...@gmail.com> wrote: > Hi, > > I was wondering if I could get some suggestions on how to write a single > list of numbers to a .m file (for matlab) so that I can create a matlab > vector out of the list of numbers from my python program. I have been using > a csv writer to create .m files from lists of lists, but I'm not sure how to > write just a single list to the file. (if I use the same code I've been > using, I get an error: csv.Error sequence expected)
You didn't provide any code, but since csv is probably overkill anyway: m_file.write("[" + " ".join(str(num) for num in numbers) + "]\n") Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list