bugGNU Octave - Bugs: bug #42023, dlmread doesn't honor 'emptyvalue'...

 
 

bug #42023: dlmread doesn't honor 'emptyvalue' value for empty delimiter

Submitter:  Philip Nienhuis <philipnienhuis>
Submitted:  Tue 01 Apr 2014 08:44:32 PM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Philip Nienhuis Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 23 Oct 2016 09:34:05 PM UTC, comment #1: 

I checked in a major overhaul of dlmread to fix issues in bug #42025.  The first part of the bug was fixed in that process.  See http://hg.savannah.gnu.org/hgweb/octave/rev/471cc4268677.

The second half of the bug, imp2b.txt, was fixed in this cset http://hg.savannah.gnu.org/hgweb/octave/rev/a93887d7f0da.

Fixed, closing report.

Rik <rik5>
Group administrator
Tue 01 Apr 2014 08:44:32 PM UTC, original submission:  

(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


Philip Nienhuis <philipnienhuis>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by philipnienhuis (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-10-23 rik5 StatusNone Fixed
        Open/ClosedOpen Closed
    2016-10-23 rik5 Dependencies- Depends on bugs #42025

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code