|
[Date Index]
[Thread Index]
[Author Index]
Re: comments in import files
- To: mathgroup at smc.vnet.net
- Subject: [mg74648] Re: comments in import files
- From: "Szabolcs" <szhorvat at gmail.com>
- Date: Thu, 29 Mar 2007 02:37:45 -0500 (EST)
- References: <eudd45$sdc$1@smc.vnet.net>
On Mar 28, 11:39 am, "beheiger" <beheiger at hotmail.com> wrote:
> Hi,
>
> 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
>
> Import["results.dat","Table"];
>
> does not complain. Help is appreciated.
>
> Regards, Andy
If nobody else posts a better solution (I hope that someone will), you
can use the grep program to strip out the comments, e.g.
readTable[filename_] := (Run["grep", "-v", "^#", filename, ">", "c:\
\temp\\tmpfile"]; Import["tmpfile", "Table"])
(This will remove lines starting with #.)
Of course you can also use Mathematica to read the file line by line
and strip out the comments, but it may be slow with large datasets.
Prev by Date:
Re: comments in import files
Next by Date:
Re: how to pass a document to word
Previous by thread:
Re: comments in import files
Next by thread:
Re: comments in import files
|