MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: CSV Format

  • To: mathgroup at smc.vnet.net
  • Subject: [mg20576] Re: [mg20555] CSV Format
  • From: Jean-Marie Thomas <jmt at agat.net>
  • Date: Sat, 30 Oct 1999 14:54:52 -0400
  • Organization: TeA
  • References: <199910300414.AAA19208@smc.vnet.net.>
  • Sender: owner-wri-mathgroup at wolfram.com

Try this :

ToCSV[data_List, aFile_String] := Module[{myStream, fl},
myStream = OpenWrite[aFile];
fl = Map[(ToString at # <> ";") &, data, {2}];
SetOptions[myStream, FormatType -> OutputForm, PageWidth -> Infinity];
Map[Write[myStream, # /. List -> Sequence] &, fl];
Close at myStream
		]

Mind the fact that you might have to format your numbers (using NumberForm) if
ever they happen to use a exponential notation.

jmt

On Sat, 30 Oct 1999, David A. Boyd wrote:
> Hello,
>     I am  a new user. How would I go about outputting a result to a
> comma separate text file? I tried  Table[ {f], {x, imin, imax, di}] >>
> \File.txt. Which creates a text file,  however my results are bracketed
> pairs {aaa,bb}, {ddd, eee}, ... which my external program does not like
> the brackets.
> 
> 
> Thanks,
> 
> dab


  • References:
    • CSV Format
      • From: "David A. Boyd" <daboyd@cco.caltech.edu>
  • Prev by Date: Re: CSV Format
  • Next by Date: Re: Corrupt Notebook
  • Previous by thread: CSV Format
  • Next by thread: Re: CSV Format