MathGroup Archive 2005

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

Search the Archive

Re: Beginner: Importing files, maintaining file format.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60669] Re: Beginner: Importing files, maintaining file format.
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Fri, 23 Sep 2005 04:20:31 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 9/22/05 at 2:08 AM, greenli7 at msu.edu (smotz555) wrote:

>I know there must be a simple solution to this...

>I have an array.dat file, that has an array in it that is already
>formatted and ready to plot. I'm going to be using the
>ListPlotVectorField, so array.dat is in the format
>{{point,vector},...}.

Is this what I would see if I opened the file with a text editor? That is a file containing nothing more than numeric data, the following characters "{","}","," and white space? If so, it sounds like the file was created by Mathematica using Put or >>. And if this is correct, the way to plot the data would be

ListPlotVectorField[<<array.dat]


>I didn't see anything that let me take in 4
>data points into that format, so I made the array.dat fit the
>ListPlotVectorField format within the program it is generated.

It isn't clear to me what you did to "fit the data points into that format". Do you mean you made the file format as described above? Or perhaps something else?

>Basically I want to get from that .dat file to being able to plot.

>I've tried using import, but the line and table format there won't
>hold the format of the file. So I tried Import["array.dat, "Text"],
>which would be optimal but resulted in the output being considered
>as text, being put in "s, and wouldn't plot until the " were
>removed. I don't really want to remove those by hand...

If you have text data aka strings, you could use the various string manipuation functions provided by Mathematica and ToExpression to convert the text into numeric data Mathematica could plot. No need to remove things "by hand".

>Then I tried using !!array.dat, but I can't seem to label that
>output as anything.  I tried !!array.dat followed by varray = %,
>but when I plotted it said varray was null. I also tried a few
>other things similar to that.

Right. The !! operator is intended to simply display the contents of a file, not get the contents into a format that can be manipulated.

>Any suggestions or a better method? Maybe there is another
>specification I can put in the Import function?

There are all sorts of options that can be used with Import. But Import doesn't sound like the best solution for you.
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: text in 3d graph
  • Next by Date: Re: Re: Hi all, can somebody tell me how to compile latex file converted from mathematica's nb ?
  • Previous by thread: Re: Beginner: Importing files, maintaining file format.
  • Next by thread: Re: Bugs in Mathematica 5+