Re: writing mathematica data to a tab delimited file??
- To: mathgroup at smc.vnet.net
- Subject: [mg18339] Re: writing mathematica data to a tab delimited file??
- From: paulh at wolfram.com (P.J. Hinton)
- Date: Wed, 30 Jun 1999 14:13:15 -0400
- Organization: Wolfram Research, Inc.
- References: <7l5t26$il6@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <7l5t26$il6 at smc.vnet.net>, Mike <mike.honeychurch at chemistry.oxford.ac.uk> writes:
> I frequently read data into mathematica that has been given to me as a
> two column tab delimited text file. Is their some way of saving a
> mathematica list eg.
>
> mylist=Table[{1, x}, {x, 1, 10, 1}]
>
> as a file in a tab delimited two column format
>
> 1 1
> 1 2
> 1 3
> 1 4
>
> etc.
>
> to be read by other people in eg. excel or sigma plot?
In Mathematica 4:
Export["filename.dat", mylist]
If you do not wish to use the .dat extension, you can use:
Export["filename", mylist, "Table"]
In[1]:= mylist=Table[{1, x}, {x, 1, 10, 1}]
Out[1]= {{1, 1}, {1, 2}, {1, 3}, {1, 4}, {1, 5}, {1, 6}, {1, 7}, {1, 8},
> {1, 9}, {1, 10}}
In[2]:= Export["filename.dat", mylist]
Out[2]= filename.dat
In[3]:= !! filename.dat
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
For earlier releases, you can define a function like WriteMatrix[]
as shown in this FAQ page.
http://support.wolfram.com/Kernel/Files/WriteMatrix.html
--
P.J. Hinton
Mathematica Programming Group paulh at wolfram.com
Wolfram Research, Inc.
Disclaimer: Opinions expressed herein are those of the author alone.