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

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

[Octave-bug-tracker] [bug #57812] [octave forge] (io) xlsread imports ac


From: Ben Stanley
Subject: [Octave-bug-tracker] [bug #57812] [octave forge] (io) xlsread imports accounting negative numbers as NaN
Date: Sat, 15 Feb 2020 20:26:00 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/79.0.3945.130 Chrome/79.0.3945.130 Safari/537.36

Follow-up Comment #7, bug #57812 (project octave):


[comment #6 comment #6:]
> I pushed such a fix here:
> http://hg.code.sf.net/p/octave/io/rev/804c6f9e680f
> 
I tested that mod. It produces an empty numarr.

>> pkg load io; [numarr,txtarr,rawarr,limits]=xlsread('Example.ods')
numarr = [](0x0)
txtarr =
{
  [1,1] = -1234
}
rawarr =
{
  [1,1] = -1234
}
limits =

  scalar structure containing the fields:

    numlimits = [](0x0)
    txtlimits =

      1   1
      1   1

    rawlimits =

      1   1
      1   1


>>

I believe the patch is missing a call to str2double, as follows:
                case "float"
                  rawarr{irow, icol} = str2double (getxmlattv (tcell,
"office:value"));

With this change, I can now read numarr:
>> pkg load io; [numarr,txtarr,rawarr,limits]=xlsread('Example.ods')
numarr = -1234
txtarr = {}(0x0)
rawarr =
{
  [1,1] = -1234
}
limits =

  scalar structure containing the fields:

    numlimits =

       1   1
       1   1

    txtlimits = [](0x0)
    rawlimits =

       1   1
       1   1


>>

Attempting to read a file with an error produces the following result:
>> pkg load io; [numarr,txtarr,rawarr,limits]=xlsread('Example2.ods')

OpenJDK 64-Bit Server VM warning: Archived non-system classes are disabled
because the java.system.class.loader property is specified (value =
"org.octave.OctClassLoader"). To use archived non-system classes, this
property must be not be set
Detected XLS interfaces: numarr =

  -1234
    NaN
      3

txtarr =
{
  [1,1] = #DIV/0!
}
rawarr =
{
  [1,1] = -1234
  [2,1] = #DIV/0!
  [3,1] =  3
}
limits =

  scalar structure containing the fields:

    numlimits =

       1   1
       1   3

    txtlimits =

       1   1
       2   2

    rawlimits =

       1   1
       1   3


>>

I believe this result is correct.
Please add str2double to the patch and it should be good.

(file #48418)
    _______________________________________________________

Additional Item Attachment:

File name: Example2.ods                   Size:8 KB
    <https://savannah.gnu.org/file/Example2.ods?file_id=48418>



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57812>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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