[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Possible bug in textread
From: |
João Rodrigues |
Subject: |
Possible bug in textread |
Date: |
Sun, 27 Oct 2013 10:54:52 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 |
Hi,
I was experimenting with textread and got what I believe to be a bug.
If the contents of test.dat are:
A B C
a 10 100
b 20 200
c 30 300
d 40 400
e 50 500
the command:
[a,b,c] = textread('test.dat', '%s %d %d', 'headerlines', 1)
yields:
error: textread: A(I): index out of bounds; value 1 out of bound 0
error: called from:
error: /usr/share/octave/3.6.4/m/io/textread.m at line 75, column 3
but:
[a,b,c] = textread('test.dat', '%s %d %d', n, 'headerlines', 1)
yields the correct result. E.g., if n = 3:
a = { [1,1] = a [2,1] = b [3,1] = c }
b = [ 10 ; 20 ; 30 ]
c = [ 100 ; 200 ; 300 ]
Alternatively, omitting 'headerlines' works fine without the need to
specify n:
[a,b,c] = textread('test.dat', '%s %d %d')
a = { [1,1] = A [2,1] = a [3,1] = b [4,1] = c [5,1] = d [6,1] = e}
b = [ 0 ; 10 ; 20 ; 30 ; 40 ; 50 ]
c = [ 0 ; 100 ; 200 ; 300 ; 400 ; 500 ]
My octave version is 3.6.4.
Best regards,
Joao