# HG changeset patch # User Ben Abbott # Date 1292029165 18000 # Node ID 5e5c513ea4c58c174714e971ddbd47defd4f45f8 # Parent cc7f30d3fd01d3f130a5eb33a1a14b7582605954 strread.m: Don't require space between format specifiers. diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2010-12-10 Ben Abbott + + * io/strread.m: Don't require space between format specifiers. + 2010-12-10 Rik * testfun/speed.m: Eliminate line continuation in function definition. diff --git a/scripts/io/strread.m b/scripts/io/strread.m --- a/scripts/io/strread.m +++ b/scripts/io/strread.m @@ -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]);