# HG changeset patch # User Ethan Biery # Date 1443731593 -7200 # Node ID 66adbb6e88adee55a85619d2869f26029bbc9784 # Parent bbe6a846d8ac938b17764dc5175407c2e7714268 textread.m, textscan.m: always remove headerlines args before invoking strread (bug #46080) diff --git a/scripts/io/textread.m b/scripts/io/textread.m --- a/scripts/io/textread.m +++ b/scripts/io/textread.m @@ -143,11 +143,10 @@ ## Beware of zero valued headerline, fskipl would skip to EOF if (varargin{headerlines + 1} > 0) fskipl (fid, varargin{headerlines + 1}); - varargin(headerlines:headerlines+1) = []; - nargin = nargin - 2; elseif (varargin{headerlines + 1} < 0) warning ("textread: negative headerline value ignored"); endif + varargin(headerlines:headerlines+1) = []; endif st_pos = ftell (fid); diff --git a/scripts/io/textscan.m b/scripts/io/textscan.m --- a/scripts/io/textscan.m +++ b/scripts/io/textscan.m @@ -202,11 +202,11 @@ if (args{headerlines + 1} > 0) ## Beware of zero valued headerline, fskipl would skip to EOF fskipl (fid, args{headerlines + 1}); - args(headerlines:headerlines+1) = []; st_pos = ftell (fid); elseif (args{headerlines + 1} < 0) warning ("textscan.m: negative headerline value ignored"); endif + args(headerlines:headerlines+1) = []; endif ## Read a first file chunk. Rest follows after endofline processing [str, count] = fscanf (fid, "%c", BUFLENGTH);