Re: Plotting from a file
- To: mathgroup at smc.vnet.net
- Subject: [mg33113] Re: Plotting from a file
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Sun, 3 Mar 2002 17:15:16 -0500 (EST)
- References: <a5t269$65v$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Sune,
The importation seems to work OK using Mathematica 4.1
Otherwise
rl=ReadList["datafile.dat",Table[Word, {7}]]
res= Map[ToExpression[StringReplace[#, "e"->" 10^"]]&,rl,{2}]
To get the second column use
col2 = res[[All,2]]
To plot this use
ListPlot[col2, PlotRange ->All]
The "option2 PlotRange->All will prevent any outliers being left out.
--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565
"SuneF" <noluck at nowhere.dk> wrote in message
news:a5t269$65v$1 at smc.vnet.net...
> Hi
>
> I have this output file of floating point data from a C program.
> It is all printed in 1.435664334e-013 notation, 7 columns in total.
>
> When I import with:
> data=Import["datafile.dat","Table"]
> it doesn't understand the exponential notation.
> It's printing the whole file (huge file by the way) below the command and
> only a handfull of the floats seem to be understood correctly as
1.333^10-13.
> If I print the numbers as 0.00000001234 then mathematica understands,
> but this is not ideal, obviously.
>
> Also, later when it works I need to plot the columns, something like
> Plot[data(2,*)]
> you know, plot the second column.
> The code doesn't work, mathematica doesn't take arrays like that, not sure
why.
>
> I'm very confused about why mathematica have both lists, arrays and
matrices,
> I don't know what to work with in this case.
>
> Is it possible to declare a datatype like in C++ ?
> I like to know what I'm working with, call it force of habbit ;)
>
> Thanks,
> Sune.
>
>