MathGroup Archive 2002

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

Search the Archive

Re: How to export plain text numbers!?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36784] Re: How to export plain text numbers!?
  • From: "Lawrence A. Walker Jr." <lwalker701 at earthlink.net>
  • Date: Wed, 25 Sep 2002 01:51:07 -0400 (EDT)
  • Organization: Morgan State University, COMSARE
  • References: <ammfo0$lkj$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Soxos,

You can use

Export["file.dat", expr] where expr is a two-dimensional array.

Or for more flexibility study the following.

Assuming data has n rows and 2 columns.

file = OpenWrite["file.dat"];
Map[
   (
      (* the N may be redundant haven't tested the
         code w/o it *)
      str = ToString[PaddedForm[N[#[[1]]],{10,6}]]<>"   "<>
            ToString[PaddedForm[N[#[[2]]],{10,6}]];

      (* make numbers e notation:
         the *^ notation has given me fits, so I just put this
         in as a precaution *)
      str = StringReplace[str, "*^" -> "e"];
      WriteString[file, str, "\n"]
   )&, data];

Close[file]


Hope this helps,
Lawrence


Soxos wrote:
> Hi,
> I'm trying to export a table from Mathematica 4.0 to Notepad, for examples,
> or something similar, but it's impossible for me! It always exports the cell
> with all its "rubbish", or an image (if I use Word).
> How can I export just plain _numbers_?
> 
> Thanx
> Fip
> 
> 


-- 
Lawrence A. Walker Jr.
http://www.kingshonor.com


  • Prev by Date: Exporting Fonts Mathematica 4.2 Linux
  • Next by Date: A Bessel integral
  • Previous by thread: Re: How to export plain text numbers!?
  • Next by thread: Question KeyEventTranslation