From: John H. <jdh...@ac...> - 2005-01-31 19:46:26
|
>>>>> "Stephen" == Stephen Walton <ste...@cs...> writes: Stephen> Humufr wrote: >> I agree with you but in the load function documentation I can >> read this: >> >> x,y = load('test.dat') # data in two columns Stephen> The documentation for load is correct. Consider Stephen> A=load('test.dat') Stephen> If 'test.dat' has 17 rows and 2 columns, A.shape will be Stephen> (17,2), "print A" will print an array with 17 rows and 2 Stephen> columns, and so on. But Stephen> x,y=A Stephen> will not work, because tuple unpacking of numarray arrays Stephen> goes by rows, not by columns. So the doc line with the tuple unpacking is *incorrect*, because tuple unpacking will fail w/o the transpose. I modified the docs to read Example usage: X = load('test.dat') # data in two columns t = X[:,0] y = X[:,1] Alternatively, you can do t,y = transpose(load('test.dat')) # for two column data Everybody happy with that? JDH |