MathGroup Archive 2002

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

Search the Archive

Re: Plotting from a file

  • To: mathgroup at smc.vnet.net
  • Subject: [mg33186] Re: Plotting from a file
  • From: "SuneF" <noluck at nowhere.dk>
  • Date: Thu, 7 Mar 2002 02:23:36 -0500 (EST)
  • References: <200203031130.GAA06263@smc.vnet.net> <a61v5s$gpq$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

> I think your first problem is addressed in the following FAQ
>
> http://support.wolfram.com/mathematica/kernel/files/fortran.html
>
> which describes how to set up Mathematica 4.0 to accept the exponential notation
> with Import. I often use a completely different method namely
>
> data = ReadList["datafile.dat", Number, RecordLists->True];
>
> which is left over from the pre version 4.0 days which didn't have an Import[]
> command.
>
> To suppress output in Mathematica end a command with a semicolon (as in the above
> command). This will keep Mathematica from printing the entire file.
>
> Finally, to plot your data, you have to use Mathematica syntax not Matlab. To plot
> a list, you need to use the ListPlot[] command (Plot[] plots function directly).
> The argument of ListPlot[] can be in any of several forms, a single list will be
> treated as y-values with x-values assumed to be the list {1, 2, 3, ..., n}. You
> can specify the y and x-values by using a list of {x, y} pairs like ListPlot[{{x1,
> y1}, {x2, y2}, ... {xn, yn}}].  Hope this helps.

Thanx, good tips, I will try them.

I figured out how to plot with ListPlot[], however I still don't know how to plot only one of the columns in the data file.
lets say the file has numbers like this:

0.0344    0.44554322    0.00048892
1.0344    0.05833399    0.993234444
...            ....                    .....

etc. in three columns
now if I scan this into data as:
data=Import["file.dat",....];
then
ListPlot[data];
will plot all three curves, suppose I'm only interested in the second column, then how do I write that?
ListPlot[data[2]] ?

Seems data is just an array of dimension 500x3, there must be a way of getting all the elements ix2 (i=1;500) pulled out and
plottet?

-S.







  • Prev by Date: Re: Re: integral transform definition
  • Next by Date: Thanks to all for the help - and a roadie question....
  • Previous by thread: Re: Plotting from a file
  • Next by thread: Re: Plotting from a file