[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #42023] dlmread doesn't honor 'emptyvalue' val
From: |
Philip Nienhuis |
Subject: |
[Octave-bug-tracker] [bug #42023] dlmread doesn't honor 'emptyvalue' value for empty delimiter |
Date: |
Tue, 01 Apr 2014 20:44:33 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 5.1; rv:25.0) Gecko/20100101 Firefox/25.0 SeaMonkey/2.22.1 |
URL:
<http://savannah.gnu.org/bugs/?42023>
Summary: dlmread doesn't honor 'emptyvalue' value for empty
delimiter
Project: GNU Octave
Submitted by: philipnienhuis
Submitted on: Tue 01 Apr 2014 10:44:32 PM CEST
Category: Libraries
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name: Philip Nienhuis
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: Any
_______________________________________________________
Details:
(Not sure if I fully understand dlmread's behavior but here goes:)
File imp2a.txt:
aaaa 11
bbbb
cccc 33
(note trailing space on L.2 after bbbb)
>> dlmread ('imp2a.txt', ' ', 0, 1, 'emptyvalue', NaN)
ans =
11
NaN
33
##.............OK, the expected result
>> dlmread ('imp2a.txt', '', 0, 1, 'emptyvalue', NaN)
ans =
11
0
33
##.............?? expected (hoped for) NaN rather than 0 in L.2
Note the only difference is an empty delimiter in the second call.
dlmread's behavior for this case of an empty delimiter isn't described in
dlmread's help. I suppose it's meant, like in Matlab, to treat multiple
consecutive spaces as one delimiter.
Now consider file imp2b.txt:
aaaa 11
bbbb
cccc 33
(same as imp2a.txt but now w/o trailing space on L.2)
>> dlmread ('imp2b.txt', '', 0, 1, 'emptyvalue', NaN)
ans =
11
0
33
>> dlmread ('imp2b.txt', ' ', 0, 1, 'emptyvalue', NaN)
ans =
11
0
33
Here, both dlmread calls (with empty and with space delimiter) yield results I
didn't expect (hope for).
As to ML: that doesn't have the 'emptyvalue' parameter; calling dlmread (w/o
'emptyvalue' parameter) in ML gets me
11
0
33
for all four cases above.
Background: I'm trying to get importdata.m more ML-compatible. To that end,
dlmread should return proper NA values when called with '"emptyvalue", NA' and
an empty delimiter.
The importdata.m incompatibility is this:
Octave:
>> res = importdata ('imp2a.txt', ' ')
res =
scalar structure containing the fields:
data =
11
0
33
<snip>
where ML r2014a gives:
>> res.data
ans =
11
NaN
33
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?42023>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Octave-bug-tracker] [bug #42023] dlmread doesn't honor 'emptyvalue' value for empty delimiter,
Philip Nienhuis <=