MathGroup Archive 2007

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

Search the Archive

Re: comments in import files

On 3/28/07 at 4:36 AM, beheiger at (beheiger) wrote:

>I would like to know if Mathematica can handle comments in import
>files. In particular, I would like to add lines of comments to an
><emptyspace>-separated ASCII table (say, "results.dat") that I
>produced with other programs. However, I can't seem to find anything
>on how to write these comments in such a way that Mathematica's
>function, used as


My approach for dealing with this issue is to format the data in
a fashion consistent with using the Mathematica Get function.

Specifically, I save data from other apps as comma separated
values and surround each line with {} characters terminating
lines with a ,. Then adding a { at the beginning and a } at the
end allows the entire file to be read into a Mathematica
variable using Get.

With this structure, it is a simple matter to add comments any
where in the file separating them with (* and *). Mathematica
will ignore these when the file is read using Get.

This structure allows me to easily look at the data files with a
text editor to see what they contain.

In addition, I've created a couple of functions to use within
Mathematica that allow me to read just the comments or append
comments to any text file. If there is interest, I will post
those here.
To reply via email subtract one hundred and four

  • Prev by Date: Re: Re: Is this a problem in mathematica?
  • Next by Date: Re: Is this a problem in mathematica?
  • Previous by thread: Re: comments in import files
  • Next by thread: Re: comments in import files