Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*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 1998

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

Search the Archive

Re: Thank you



Mingwu Bai wrote:
> Please kindly tell
> me h ow to output the calculation results to a file, not to a 
> graph.
> 
> For example,
> Plot[Sin[x], {x, 0, 3.14}]
> I want to output the both the x and Sin[x] results to a file (e.g.,
> "filename").

First extract the coordinates:
data =
Join@@Cases[
	Plot[Sin[x], {x, 0, 3.14},DisplayFunction -> Identity],
	Line[pts_]->pts, 
	Infinity
];  

Where:
DisplayFunction -> Identity suppresses display Line[pts_]->pts extracts
the coordinates Infinity makes Sases search at all levels Join joins
the coordinate lists from several line segments (there is only one
segment here)

Now write to file

Write["sinfile",data]

-- 
Allan Hayes
Training and Consulting
Leicester, UK
hay@haystack.demon.co.uk
http://www.haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44 (0)116 271 8642




  • Prev by Date: Re: Random Order of a Set of Numbers
  • Next by Date: Re: ListPlot and List problem
  • Prev by thread: Re: Thank you
  • Next by thread: String patterns