bugGNU Octave - Bugs: bug #56375, [octave forge] (io) odswrite...

 
 

bug #56375: [octave forge] (io) odswrite writes zeros for NA and NaN

Submitter:  Nicholas Jankowski <nrjank>
Submitted:  Wed 22 May 2019 07:45:59 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  philipnienhuis
Originator Name:  Nicholas Jankowski Open/Closed:  * Closed
Release:  * other Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 08 Jun 2019 08:48:02 PM UTC, comment #6: 

Fixed here:
http://hg.code.sf.net/p/octave/io/rev/be77ce651687

I hope to be able to make an io-2.4.13 release in June with this fix.

Closing report

Philip Nienhuis <philipnienhuis>
Group Member
Tue 04 Jun 2019 09:34:52 PM UTC, comment #5: 

BTW only the native OCT interface is affected - all other interfaces (Java-based) work fine.
BUT ... also .gnumeric needs fixing.

Philip Nienhuis <philipnienhuis>
Group Member
Tue 04 Jun 2019 09:30:10 PM UTC, comment #4: 

I have a -what I thought- partial fix that to my surprise fixes all NA/NaN occurrences.
Hmmm, I need a bit more time for testing and evaluating the code.

Philip Nienhuis <philipnienhuis>
Group Member
Wed 22 May 2019 09:58:52 PM UTC, comment #3: 

@Mike:

ODF toolkit, jOpendocument: simply add the required jars to the javaclasspath.
chk_spreadsheet_support ("/full/path/to/jars", 3) gives full details (debug detail level 3) of required and found files.

LO: is different, something like chk_spreadsheet_support ("", 3, "/full/path/to/libreoffice") should/might work.
IIRC the trick is to find where soffice.bin resides and feed that or the containing libreoffice/ subdir to chk_spreadsheet_support.m (but its a long time ago I touched that code, esp. for Linux boxes. It has been working flawlessly for years now on my Windows boxes so I never had to look).

The bug itself is probably easy to fix for the OCT interface, I guess somewhere in <io>/private/__OCT_oct2ods__.m, probably in the switch stmt around L. 238 or maybe L.217.
It is fairly complicated code because .ods is a very very complicated format.

I'll look at it when I'm back after next week.

Philip Nienhuis <philipnienhuis>
Group Member
Wed 22 May 2019 09:21:45 PM UTC, comment #2: 

Confirmed on Debian with the oct interface. I have no idea how to test the Java interface, adding /usr/share/java to my class path doesn't seem to have helped the functions find the LibreOffice jar files that are in that directory.

Mike Miller <mtmiller>
Group Member
Wed 22 May 2019 08:16:20 PM UTC, comment #1: 

So it is the OCT interface (native Octave code) that does it. windows pkg loaded makes no difference (as to be expected).

I'll check in June whether this also happens with the Java-based interfaces, or maybe/hopefully someone will beat me to it.

Just FYI, in future io package releases I'm going to integrate odswrite into xlswrite, similarly for odsread & odsfinfo (& xodsoct, oct2ods, odsopen, odsclose). They'll still be around for a while but merely as wrappers.
This will make for significant code deduplication and probably less maintenance.

Philip Nienhuis <philipnienhuis>
Group Member
Wed 22 May 2019 07:45:59 PM UTC, original submission:  

as discussed in bug #56373,  odswrite produces .ods files with 0 in place of NA or NaN array values.  Octave's xlswrite output is a blank cell for NA and NAN. The NaN output is Matlab compatible behavior. Matlab does not appear to support NA or ODS output.

Note that bug #56373 describes an issue where xlswrite is producing 65536 instead of blanks for certain versions/packages. This appears to be separate from this odswrite issue.



>> pkg load io
>> chk_spreadsheet_support ()
ans = 0
>> a = NA(5)
a =

    NA    NA    NA    NA    NA
    NA    NA    NA    NA    NA
    NA    NA    NA    NA    NA
    NA    NA    NA    NA    NA
    NA    NA    NA    NA    NA

>> odswrite('testNA.ods',a)
Detected ODS interfaces: OCT*; (* = default interface)
ans =  1

output file has all zeros.


close/restart, then:

>> pkg load io
>> pkg load windows
>> chk_spreadsheet_support ()
ans =  1
>> a = NA(5)
a =

    NA    NA    NA    NA    NA
    NA    NA    NA    NA    NA
    NA    NA    NA    NA    NA
    NA    NA    NA    NA    NA
    NA    NA    NA    NA    NA

>> odswrite('testNA.ods',a)
Detected ODS interfaces: OCT*; (* = default interface)
ans =  1


again, output file has all zeros.  same behavior with NaN.

Nicholas Jankowski <nrjank>
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

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by nrjank (Submitted the item)
  • -email is unavailable- added by nrjank
  •  

    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 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-06-08 philipnienhuis StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2019-06-04 philipnienhuis StatusConfirmed In Progress
        Assigned toNone philipnienhuis
        Release5.1.0 other
    2019-05-22 mtmiller StatusNone Confirmed
        Operating SystemMicrosoft Windows Any
        Summary[octave-forge] (io) odswrite writs zeros for NA and NaN [octave forge] (io) odswrite writes zeros for NA and NaN
    2019-05-22 philipnienhuis Summaryxlswrite and odswrite produce different outputs for NA and NaN [octave-forge] (io) odswrite writs zeros for NA and NaN
    2019-05-22 nrjank Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code