[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #34734] problems with latest strread (newlines
From: |
Kris Thielemans |
Subject: |
[Octave-bug-tracker] [bug #34734] problems with latest strread (newlines, spaces and commas) |
Date: |
Thu, 03 Nov 2011 12:25:30 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1 |
URL:
<http://savannah.gnu.org/bugs/?34734>
Summary: problems with latest strread (newlines, spaces and
commas)
Project: GNU Octave
Submitted by: krthie
Submitted on: Thu 03 Nov 2011 12:25:29 GMT
Category: Libraries
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name: Kris Thielemans
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: Any
_______________________________________________________
Details:
This was originally discussed on the Octave- general mailing list (See the
thread
http://octave.1599824.n4.nabble.com/problems-with-latest-strread-comma-delimiters-tt3913839.html#a3919252).
Some behaviour reported here is related to bug #34713
(https://savannah.gnu.org/bugs/index.php?34713)
I'm trying to use textread but had trouble on Octave 3.4.2 (built from source
on Ubuntu 11.04). Therefore, I downloaded the latest strread.m from mercurial,
renaming it to newstrread.m.
However, newstrread behaves unexpectly with commas/spaces and newlines.
octave> [a1,a2]=newstrread("1,2\n3,4\n", '%f%f', 'delimiter',',')
a1 =
1
4
a2 =
23
NaN
The newline was not considered as a "new record" and just ignored. Instead,
the 3.2.4 version of strread reads this correctly:
octave> [a1,a2]=strread("1,2\n3,4\n", '%f%f', 'delimiter',',')
a1 =
1
3
a2 =
2
4
Here's another case where both the 3.2.4 and new strread (and textread) ignore
some unknown characters, which causes rather strange results:
octave> [a1,a2]=newstrread("1a2\n3,4", '%f%f')
a1 = NaN
a2 = 34
Returning a NaN for the first line is ok, but ignoring the comma is wrong (see
bug #34713).
In the discussion in the email thread, it appeared that this behaviour is
partly due to the fact that currently strread doesn't interpret a new line as
a new "record", which seems incorrect.
Another example without newlines
octave> [a1,a2]=newstrread("1 2, 3 4",'%f%f','delimiter','t')
a1 = 1234
a2 = [](0x1)
IMO, whitespace and commas should not be ignored "inside" a field (whitespace
should of course be ignored between fields when using the above format
specifier).
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?34734>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #34734] problems with latest strread (newlines, spaces and commas),
Kris Thielemans <=
- [Octave-bug-tracker] [bug #34734] problems with latest strread (newlines, spaces and commas), Philip Nienhuis, 2011/11/03
- [Octave-bug-tracker] [bug #34734] problems with latest strread (newlines, spaces and commas), Kris Thielemans, 2011/11/03
- [Octave-bug-tracker] [bug #34734] problems with latest strread (newlines, spaces and commas), Philip Nienhuis, 2011/11/03
- [Octave-bug-tracker] [bug #34734] problems with latest strread (newlines, spaces and commas), Philip Nienhuis, 2011/11/06
- [Octave-bug-tracker] [bug #34734] problems with latest strread (newlines, spaces and commas), Ben Abbott, 2011/11/27
- [Octave-bug-tracker] [bug #34734] problems with latest strread (newlines, spaces and commas), Ben Abbott, 2011/11/27
- [Octave-bug-tracker] [bug #34734] problems with latest strread (newlines, spaces and commas), Philip Nienhuis, 2011/11/28