diff scripts/io/strread.m @ 11343:5e5c513ea4c5

strread.m: Don't require space between format specifiers.
author Ben Abbott <bpabbott@mac.com>
date Fri, 10 Dec 2010 19:59:25 -0500
parents 564e998017f5
children c776f063fefe
line wrap: on
line diff
--- a/scripts/io/strread.m	Fri Dec 10 15:36:44 2010 -0800
+++ b/scripts/io/strread.m	Fri Dec 10 19:59:25 2010 -0500
@@ -187,6 +187,7 @@
   endif
 
   ## Determine the number of words per line
+  formatstr = strrep (formatstr, "%", " %");
   [~, ~, ~, fmt_words] = regexp (formatstr, "[^\\s]+");
 
   num_words_per_line = numel (fmt_words);
@@ -246,6 +247,10 @@
 endfunction
 
 %!test
+%! [a, b] = strread ("1 2", "%f%f");
+%! assert (a == 1 && b == 2);
+
+%!test
 %! str = "# comment\n# comment\n1 2 3";
 %! [a, b] = strread (str, '%d %s', 'commentstyle', 'shell');
 %! assert (a, [1; 3]);