[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #35824] proposed fix for: textread: A(I): inde
From: |
indium |
Subject: |
[Octave-bug-tracker] [bug #35824] proposed fix for: textread: A(I): index out of bounds; |
Date: |
Tue, 13 Mar 2012 10:25:35 +0000 |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2 |
URL:
<http://savannah.gnu.org/bugs/?35824>
Summary: proposed fix for: textread: A(I): index out of
bounds;
Project: GNU Octave
Submitted by: indium
Submitted on: Tue 13 Mar 2012 10:25:33 GMT
Category: None
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: GNU/Linux
_______________________________________________________
Details:
in ....//3.7.0+/m/io/textread.m
change line 75:
if (nargin > 2 && isnumeric (varargin{1}))
to:
if (nargin > 2 && !isempty(varargin) && isnumeric (varargin{1}))
Because:
When using the 'skip headerlines' facility (and nothing else), the varargin is
made empty after the skipping. isnumeric() will then choke on varargin{1}.
Example: when reading this file:
05/12/11 10:44:28 43.3438 22 22.5144 20 24.4452
05/12/11 10:45:28 44.016 23.45 22.2151 21.87 25 24.3011
05/12/11 10:46:28 44.1075 25.54 21.7423 21.25 25 24.2013
05/12/11 10:47:28 44.167 25.94 21.2358 20.73 25 24.1519
05/12/11 10:48:28 44.336 25.91 20.7838 20.43 25 24.179
05/12/11 10:49:28 44.3283 25.62 20.4178 20.21 25 24.2633
05/12/11 10:50:28 44.6764 25.38 20.1398 20 25 24.2847
05/12/11 10:51:28 44.7924 25.27 20.1398 20 25 24.3005
05/12/11 10:52:28 44.9006 25.16 19.9312 19.98 25 24.8987
05/12/11 10:53:28 48.1813 25.06 19.8178 19.93 25 25.1665
05/12/11 10:54:28 43.0412 25.01 19.7655 19.93 25 24.9862
I get the following error:
octave:1> [a1,a2,a3,a4,a5,a6,a7,a8]=textread ("./s.txt" ,"%s %s %f %f %f %f %f
%f","headerlines",3)
error: textread: A(I): index out of bounds; value 1 out of bound 0
error: called from:
error: /home/indium/share/octave/3.7.0+/m/io/textread.m at line 75, column
3
octave:1>
I think the problem is in varargin{1}:
in the beginning varargin has two components:
varargin =
{
[1,1] = headerlines
[1,2] = 3.0000e+00
}
but after processing these in .../3.7.0+/m/io/textread.m line 67 to 73, these
two components are removed:
varargin(headerlines:headerlines+1) = [];
Which is why varargin{1} is none-existant.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?35824>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #35824] proposed fix for: textread: A(I): index out of bounds;,
indium <=