octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #34734] problems with latest strread (newlines


From: Ben Abbott
Subject: [Octave-bug-tracker] [bug #34734] problems with latest strread (newlines, spaces and commas)
Date: Wed, 21 Dec 2011 17:00:59 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7

Follow-up Comment #10, bug #34734 (project octave):

Thanks Jordi. With the rebased changeset;


test strread
PASSES 19 out of 19 tests
test textscan
PASSES 13 out of 13 tests
test text
text      textread  textscan  
test textread
  ***** test
 f = tmpnam();
 d = rand (5, 3);
 dlmwrite (f, d, 'precision', '%5.2f');
 [a, b, c] = textread (f, "%f %f %f", "delimiter", ",", "headerlines", 3);
 unlink(f);
 assert (a, d(4:5, 1), 1e-2);
 assert (b, d(4:5, 2), 1e-2);
 assert (c, d(4:5, 3), 1e-2);
!!!!! test failed
assert (a,d (4:5, 1),1e-2) expected
   0.96669
   0.41522
but got
   0.97000
       NaN
       NaN
   0.45000
Dimensions don't match


After reverting the strread.m changeset


test textread
PASSES 5 out of 5 tests


I ran fntests() and didn't see any other problems.

The test failure for textread() is due to a new bug in strread(). The script
below illustrates the problem.


str =  "0.31, 0.86, 0.94n 0.60, 0.72, 0.87";
fmt = "%f %f %f";
args = {"delimiter", ",", "endofline", "n", "whitespace", " "};
[a, b, c] = strread (str, fmt, args {:});
assert (a, [0.31; 0.60], 0.01)
assert (b, [0.86; 0.72], 0.01)
assert (c, [0.94; 0.87], 0.01)


The first assert throws an error.


error: assert (a,[0.31; 0.60],0.01) expected
   0.31000
   0.60000
but got
   0.31000
       NaN
       NaN
   0.87000
Dimensions don't match


With the commas (",") removed from str, the script runs without error.

With all the spaces removed form str, the script also runs without error.

I've attached a modified changeset with additional tests added. The last test
fails per above.

(file #24641)
    _______________________________________________________

Additional Item Attachment:

File name: strread-rebased-with-tests.patch Size:11 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?34734>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]