# HG changeset patch # User Rik # Date 1311378460 25200 # Node ID e8c8e118a1e6e9fd786ba85358c3fb37de1f2d7b # Parent 031e1a2c26f3355bf7056c37de9677f5f89c8505 Small touchups to textscan and strread revamp * textscan.m: Stop passing headerlines option to strread. * strread.m: Use str2double, not str2num, for better performance. diff -r 031e1a2c26f3 -r e8c8e118a1e6 scripts/io/strread.m --- a/scripts/io/strread.m Fri Jul 22 15:30:52 2011 -0700 +++ b/scripts/io/strread.m Fri Jul 22 16:47:40 2011 -0700 @@ -529,7 +529,7 @@ k++; case {"%0", "%1", "%2", "%3", "%4", "%5", "%6", "%7", "%8", "%9"} nfmt = strsplit (fmt_words{m}(2:end-1), '.'); - swidth = str2num (nfmt{1}); + swidth = str2double (nfmt{1}); switch fmt_words{m}(end) case {"d", "u", "f", "n%"} n = cellfun ("isempty", data); @@ -541,7 +541,7 @@ data(end+1:num_lines) = numeric_fill_value; endif if (numel (nfmt) > 1) - sprec = str2num (nfmt{2}); + sprec = str2double (nfmt{2}); data = 10^-sprec * round (10^sprec * data); endif varargout{k} = data.'; diff -r 031e1a2c26f3 -r e8c8e118a1e6 scripts/io/textscan.m --- a/scripts/io/textscan.m Fri Jul 22 15:30:52 2011 -0700 +++ b/scripts/io/textscan.m Fri Jul 22 16:47:40 2011 -0700 @@ -142,6 +142,7 @@ ## Beware of zero valued headerline, fskipl would skip to EOF if (! isempty (headerlines) && (args{headerlines + 1} > 0)) fskipl (fid, varargin{headerlines + 1}); + args(headerlines:headerlines+1) = []; endif if (isfinite (nlines)) str = "";