MathGroup Archive 1999

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

Search the Archive

Re: Re: writing mathematica data to a tab delimited file??


> Try this:
>
> In[1]:=mylist=Table[{1, x}, {x, 1, 10, 1}]
>
> In[3]:=temporal=OpenWrite["mylist.txt"];
> 	Do[WriteString[tmp,
> 	    StringTake[
> 	      StringReplace[ToString[Part[mylist,i]],","->"\t"]
> 	      ,{2,StringLength[ToString[Part[mylist,i]]]-1}],"\n"]
> 	 ,{i,1, Length[mylist]}];
> 	Close[temporal]
This has been a usual problem for novice Mathematica users. Mathematica 4
has, at last, given us a built-in solution. Cf. the function Export:

Export["file.ext", expr] exports data to a file, converting it to a format
corresponding to the file extension ext.

Export["file", expr, "format"] exports data to a file, converting it to the
specified format.

Tomas Garza
Mexico City
>
> At 3:11 PM -0400 99.6.27, Mike wrote:
> > 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?
> >
> > thanks
> >
> > Mike



  • Prev by Date: Fitting with a complex equation
  • Next by Date: Encapsulated Postscript
  • Previous by thread: Re: Fitting with a complex equation
  • Next by thread: Encapsulated Postscript