[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Plotting data from a file containing comments as first lines

From: Przemek Klosowski
Subject: Re: Plotting data from a file containing comments as first lines
Date: Tue, 8 Jun 2004 16:34:28 -0400 (EDT)

Make sure that the comment lines  start with the comment sign, '#'.
If that is not possible, you could try reading from pipes that just
read your file and strip first few lines. 

Unfortunately, as far as I can tell, Octave doesn't allow running
pipes directly where a filename would be (like in Perl expression
'open(F,"program file.dat|"). The next trick in the bag would be:

  mkfifo p
  tail +4 file.dat > p               # put lines 4,5,... of file.dat into pipe 
  load p                             # read the pipe within octave

except that it doesn't work for me---apparently the load command tries
to reread the file, and the pipe will provide the data only once. Next
thing I tried was to use 'load -ascii p' but unfortunately 'load
-ascii' doesn't read no-header/numbers-only ascii files---I checked that
on a bona-fide disk file as well as on a pipe.

We are left, therefore, with an ugly solution using a temporary file:

   system('tail +4 file.dat > /tmp/xxx')
   a = load /tmp/xxx

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]