Mercurial > hg > octave-terminal
changeset 12679:f38cf6224452 stable
Fix textscan/textread headerlines arg always skipping 2 lines (bug #33028)
* textread.m, textscan.m: Fix wrong headerline argument being fed
to fskipl. Check & avoid processing zero headerline values.
author | Philip Nienhuis <prnienhuis@users.sf.net> |
---|---|
date | Sun, 15 May 2011 19:15:50 -0700 |
parents | bedd0cdb3584 |
children | 1acead61c527 |
files | scripts/io/textread.m scripts/io/textscan.m |
diffstat | 2 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/io/textread.m +++ b/scripts/io/textread.m @@ -54,7 +54,11 @@ ## Maybe skip header lines headerlines = find (strcmpi (varargin, "headerlines"), 1); if (! isempty (headerlines)) - fskipl (fid, headerlines); + hdr_lines = floor (varargin{headerlines + 1}); + ## Beware of zero valued headerline, fskipl will count lines to EOF then + if (hdr_lines > 0) + fskipl (fid, hdr_lines); + endif varargin(headerlines:headerlines+1) = []; endif
--- a/scripts/io/textscan.m +++ b/scripts/io/textscan.m @@ -81,8 +81,11 @@ ## Maybe skip header lines headerlines = find (strcmpi (args, "headerlines"), 1); if (! isempty (headerlines)) - fskipl (fid, headerlines); - args(headerlines:headerlines+1) = []; + hdr_lines = floor (varargin{headerlines + 1}); + ## Beware of zero valued headerline, fskipl will count lines to EOF + if (hdr_lines > 0) + fskipl (fid, hdr_lines); + endif endif if (isfinite (nlines)) str = "";