How to simplify this routine which is able to export data into TXT file?
- To: mathgroup at smc.vnet.net
- Subject: [mg31229] How to simplify this routine which is able to export data into TXT file?
- From: liwen liwen <gzgear at yahoo.com>
- Date: Sat, 20 Oct 2001 04:27:02 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi, This routine is able to export many points into a TXT file, is it possible to simplfy it with the pure function? ExportAllPoints[pointset_, filename_] := Module[{stmp, m, n}, (stmp = OpenAppend[filename]; n = Length[pointset]; m = 1; While[(m <= n), (Scan[WriteString[stmp, #, " "] &, Part[pointset, m]]; WriteString[stmp, "\n"]; m = m + 1; )]; Close[stmp]; )]; data = {{4, 5, 6}, {5, 4, 3}, {8, 9.7778, 0}, {78, 89, 90, 675}}; ExportAllPoints[data, "data.txt"] Liwen __________________________________________________ Do You Yahoo!? Make a great connection at Yahoo! Personals. http://personals.yahoo.com