From: John H. <jdh...@ac...> - 2004-04-08 18:41:35
|
>>>>> "Randy" == Randy Heiland <he...@in...> writes: Randy> What's the easiest way to write a Numeric array to a file? Easiest or best? In the next release I've added load and save funcs for converting arrays to and from ascii files. But this is slow and generally lossy. Best is to use the binary string operations tostring and fromstring from Numeric import fromstring, Float # write file('fname.out', 'wb').write(x.tostring()) # read x = fromstring(file('fname.out', 'rb').read(), Float) #If data is MxN you'll need to reshape x.shape = M,N Hope this help, JDH |