textread

Michael Grossbach michael at grossbach.org
Tue May 13 12:31:46 CDT 2008


There seems to be a bug in textread (Octave 3.0.1 binary from 
sourceforge, Windows XP) related to the 'headerlines' parameter.
Assume the following in a file test.txt (without the start and end tags):
--start
1stHeaderLine

1    1stDataLine
2    2ndDataLine
--end

This, according to the help text can be read by issuing:
 [a, b] = textread ('E:\test.txt', '%d %s', 'headerlines',2)
a =  1
b =

{
  [1,1] = 1stDataLine
}

Hence, the last line is is not read. Changing the file test.txt to
--start
1stHeaderLine
1    1stDataLine
2    2ndDataLine
--end

, so by omitting the empty second header line, textread behaves as expected:
[a, b] = textread ('E:\test.txt', '%d %s', 'headerlines',1)
a =

   1
   2

b =

{
  [1,1] = 1stDataLine
  [2,1] = 2ndDataLine
}

Cheers, Michael



More information about the Bug-octave mailing list