Re: export plot data
- To: mathgroup at smc.vnet.net
- Subject: [mg47934] Re: export plot data
- From: bghiggins at ucdavis.edu (Brian Higgins)
- Date: Fri, 30 Apr 2004 19:27:34 -0400 (EDT)
- References: <c6s3r6$pb8$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Quentin, Here is one way: First create a empty text file in your favorite directory; call it mydata.txt (for this example). then evaluate plt1 = Plot[Sin[x], {x, 0, 2Pi}] mydata = Flatten[Cases[plt1, Line[x__] -> x, Infinity], 1]; Now to export the data as CSV to the file you created previous then type Export["/Users/brian/Desktop/mydata.txt", mydata, "CSV"] The first argument of Export is the filename and path that you wish to export your data. To get that info automatically place your cursor after "[" and then from the file menu select Input and then select "Get File Path.." A dialog box will open that will allow you to navigate to the file you created in Step 1. Select the file mydata.txt and the click on the Choose button. The appropriate path plus file name will be pasted as the first argument of Export. Note in the above example I used a mac with OSX. In windows the filepath syntax involves "\\" values rather than "/" values to delimit directories. If you simple type in "mydata.txt" as the first argument of Export the file is created in the default directory of Mathematica You can then open the file in Excel or other software thar recognizes CSV data Cheers, Brian grimal <grimal at univ-paris12.fr> wrote in message news:<c6s3r6$pb8$1 at smc.vnet.net>... > message to the list > > Dear list members, > > I have developed a Mathematica notebook with a Plot command at the end. > The evaluation of Plot[f,{x,xmin,xmax}] involves a function f that is > defined in the notebook; xmin and xmax are also functions defined in the > notebook and evaluated while doing the Plot. > I am satisfied with the result of the Plot command. > > Now, I would like to export in a txt file the data (list of points) > generated during the evaluation of the Plot. Then I could use the list > of points to plot the data with another software. > I have tried the Table command to generate a list but it does not seem > to work. > Can anybody help me? > > Thanks > > Quentin Grimal