MathGroup Archive 2005

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

Search the Archive

Re: Output to a file

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57032] Re: [mg57022] Output to a file
  • From: Roberto Brambilla <rlbrambilla at cesi.it>
  • Date: Thu, 12 May 2005 22:44:15 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi, Namrata,
you wrote

>I want to write the following list in a file, (and below is what I did)
>
>testList = {{1, 8}, {2, 9}, {3, 10}, {4, 11}, {5, 12}, {6, 13}, {7, 14}};
>
>str = OpenWrite["test.dat"];
>
>Write [str, testList]; Close[str];
>
>test.dat looks like
>{{1, 8}, {2, 9}, {3, 10}, {4, 11}, {5, 12}, {6, 13}, {7, 14}}
>
>But, I want the test.dat to look like:
>1  8
>2   9
>3   10
>4  11
>
>and so on...


try this :

str=OpenWrite["test.dat",FormatType>OutputForm];

For[j=1,j<=Length[testList],j++,
      st=ToString[testList[[j,1]]]<>"  "<>ToString[testList[[j,2]]];
      Write[str.st];
      ];

Close[str];

This file can be easily read by Excel.

Bye,

Roberto Brambilla
CESI Spa
Engineering Department
Renewable Energies & Superconductivity

Via Rubattino 54,
20134 Milano
Italy

ph. +39 02 2125.5875
fax +39 02 2125.5626



CESI SpA ha adottato il Modello Organizzativo ai sensi del D.Lgs.231/2001, in forza del quale l'assunzione di obbligazioni da parte della Società avviene con firma di un procuratore, munito di idonei poteri.
CESI adopts a Compliance Programme under the Italian Law (D.Lgs.231/2001). According to this CESI Compliance Programme, any commitment of CESI is taken by the signature of one Representative granted by a proper Power of Attorney.

Le informazioni contenute in questo messaggio di posta elettronica sono riservate e confidenziali e ne e' vietata la diffusione in qualsiasi modo o forma. Qualora Lei non fosse la persona destinataria del presente messaggio,   La invitiamo a non diffonderlo e ad eliminarlo, dandone gentilmente comunicazione al mittente.
The information included in this e-mail and any attachments are confidential and may also be privileged. If you are not the correct recipient, you are kindly requested to notify the sender immediately, to cancel it and not to disclose the contents to any other person.


  • Prev by Date: Re: another image problem
  • Next by Date: Re: Converting result to ASCII-art
  • Previous by thread: Re: Output to a file
  • Next by thread: MapThread