Re: Save print in textfile
- To: mathgroup at smc.vnet.net
- Subject: [mg15561] Re: Save print in textfile
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 26 Jan 1999 13:44:41 -0500 (EST)
- Organization: Universitaet Leipzig
- References: <7814h5$p1v@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hello Witold
I suppose You have two lists of equal length one with the sample names
and one with the "conditions" the function
WriteMyTXT[
file_String,
name : {_String ..},
cond : {_Integer ..}] :=
Module[{stream},
stream = OpenWrite[file, FormatType -> TextForm];
Scan[
( Write[stream, "sample: ", #[[1]]];
Write[stream, "-----------------"];
Write[stream, "conditions: ", #[[2]]];
Write[stream, "-----------------"]) &, Transpose[{name,
cond}]];
Close[stream];
file
]
will do what You want. With
WriteMyTXT["textfile.txt", {"aa", "bb", "cc"}, {1, 2, 3}]
You can now save Your data. Since my SGI can't find a directory c:\temp
You
have to setup the correct location of You file by your self.
Hope that helps
Jens
wgrebe wrote:
>
> Hallo,
>
> I want to save the result of a series of Print commands in a textfile.
> For example:
> df=Do[
> Print["sample: ",name];
> Print["___________________________________"]; Print[" conditions: "
> number];
> Print["___________________________________"]; ];
> results in the output:
>
> sample: aab
> ___________________________________
> conditions: 34
> ___________________________________
>
> This output I want to have in the file "textfile.txt" in the directory
> C:\temp.
> Thank you
> Witold
> wgrebe at cityweb.de