RE: Newbie: plot data from a text file?
- To: mathgroup at smc.vnet.net
- Subject: [mg43836] RE: [mg43817] Newbie: plot data from a text file?
- From: David.Annetts at csiro.au
- Date: Wed, 8 Oct 2003 04:47:50 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi Chris,
> (I checked the manual and online help for this but I haven't found
> anything).
Depending upon the version (eg 5.0), there's a Help section in "Tour's"
called "Handling data" that should have put you on the right track.
> I have some C code that generates ordered (x,y) pairs of data. I'd
> like to be able to simply use Mathematica to plot this data. I don't
> see any arguments to Plot[] that allow this, nor do I see an
> alternative.
>
> Am I missing something obvious? Or is Mathematica the wrong tool for
> this . . .
If you haven't gone through section 1 of The Book (eg ection 1.9.8), then
you have missed something.
Try:
xdat = Table[{x, Sin[x]}, {x, -Pi, Pi, Pi/32}];
Export["test.txt", N[xdat], "Table"]
idat = Import["test.txt", "Table"];
ListPlot[idat];
Then look further at each of these options (eg. ?Table, ?Export, ?Import,
?ListPlot).
Regards,
Dave.