MathGroup Archive 2001

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

Search the Archive

Re: comma delimited output file -- modify existing code?

On Sat, 8 Dec 2001, 1.156 wrote:

> A year ago or so, some kind soul gave me the very valuable
> method of writing a tab delimited array to a text file. Due
> to incompetence on my part, I don't have his name.

Postings made to this forum are archived and may be searched at this URL:

Judging from the arcihves, it looks like the author may have been David

> My data in wList goes nicely into a tab delimited file.
> Now, I'd like to make it a comma delimited file but (again
> due to an amazing incompetence) I can't figure out how to
> modify it for commas.  The "/t" shure looks like the culprit
> but when I change it to "/c" I don't get commas but '/c' as
> delimiters. So it is the delimiter spec but what is the
> comma spec??

Within a Mathematica string, commas do not need escaping.

In[1]:= stmp = OpenWrite["test.txt"]

Out[1]= OutputStream[test.txt, 3]

In[2]:= WriteString[stmp, "before, after"]

In[3]:= Close[stmp]

Out[3]= test.txt

In[4]:= !! test.txt
before, after

Hence, you should be able to replace "\t" with ",".

If you use Mathematica 4.1, the kernel also supports export to CSV format.

P.J. Hinton
User Interface Programmer                         paulh at
Wolfram Research, Inc.
Disclaimer: Opinions expressed herein are those of the author alone.

  • Prev by Date: Re: comma delimited output file -- modify existing code?
  • Next by Date: Re: can I add fonts to Mathematica
  • Previous by thread: Re: comma delimited output file -- modify existing code?
  • Next by thread: From Spline to Arc