Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg18350] Re: [mg18337] writing mathematica data to a tab delimited file??
  • From: "Kazumi Hitomi" <hitomi at criepi.denken.or.jp>
  • Date: Wed, 30 Jun 1999 14:13:21 -0400
  • References: <199906271911.PAA19100@smc.vnet.net.>
  • Sender: owner-wri-mathgroup at wolfram.com

Hello, Mike.

I also wrote matrices as comma delimited text files frequently. Although I
believe
my method is not efficient and there may be good one,  I have used following
procedure.

(1) step 1 -  saving matrix as a text file
mylist=Table[{1,x}, {x,1,10}];

Do[
 Do[
    {
      mylist[[i,j]]=FortranForm[mylist[[i,j]];
    (*   this conversion is required for reading data   *)
    (*   from other software, such as Excel.              *)
    },{j,1,2}
 ],{i,1,10}
];

outfile=OpenWrite["---fileName---", PageWidth->300];
Write[outfile,mylist];
close[outfile];

Note: PageWidth must be adusted depending on record length
         ( or # of columns in the matrix.)

(2) step2 - reading output file using Excel
Each cell in the output file is delimited by comma and the file
contains brackets ("{" and "}") , which are used to specify
vector or matrix in Mathematica. After reading the file using
Excel, I always remove the brackets employing replace
command in order to use the data as numerics.


This is my method to save matrix as a text file.

Does anybody know more efficient one, please tell it
to Mike and ME.

Best regards,

Kazumi Hitomi

----- Original Message -----
From: Mike <mike.honeychurch at chemistry.oxford.ac.uk>
To: mathgroup at smc.vnet.net
Subject: [mg18350] [mg18337] writing mathematica data to a tab delimited file??


>
> 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: Re: easiest way to sort a list?
  • Next by Date: Re: writing mathematica data to a tab delimited file??
  • Previous by thread: writing mathematica data to a tab delimited file??
  • Next by thread: Re: writing mathematica data to a tab delimited file??