changeset 12873:e8c8e118a1e6

Small touchups to textscan and strread revamp * textscan.m: Stop passing headerlines option to strread. * strread.m: Use str2double, not str2num, for better performance.
author Rik <octave@nomad.inbox5.com>
date Fri, 22 Jul 2011 16:47:40 -0700
parents 031e1a2c26f3
children 787a84da70a6
files scripts/io/strread.m scripts/io/textscan.m
diffstat 2 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/io/strread.m
+++ b/scripts/io/strread.m
@@ -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.';
--- a/scripts/io/textscan.m
+++ b/scripts/io/textscan.m
@@ -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 = "";