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

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

[Octave-bug-tracker] [bug #57812] xlsread imports accounting negative nu


From: Ben Stanley
Subject: [Octave-bug-tracker] [bug #57812] xlsread imports accounting negative numbers as NaN
Date: Fri, 14 Feb 2020 17:22:12 -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

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

                 Summary: xlsread imports accounting negative numbers as NaN
                 Project: GNU Octave
            Submitted by: benstanley
            Submitted on: Fri 14 Feb 2020 10:22:10 PM UTC
                Category: Octave Forge Package
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: Ben Stanley
        Originator Email: 
             Open/Closed: Open
                 Release: 4.2.2
         Discussion Lock: Any
        Operating System: GNU/Linux

    _______________________________________________________

Details:

I have a finance problem that I am working on using GNU Octave.

I am using xlsread to read an Excel spreadsheet provided by a bank.

The file contains negative numbers written using accounting notation "(1234)"
-> -1234.

xlsread imports such numbers as NaN.

In my use case, I need to be able to import such numbers as negative numbers.

For the moment I will work around the problem using the rawarr output from
xlsread.

I have not tested what Matlab xlsread does in this case.

The problem appears to be in parsecell.m in the following lines:
        ## Watch out for scalar (non-empty) numarr where emptr = 0
        if (sum (emptr(:)) > 0)
          numarr(emptr(irowt:irowb, icoll:icolr)) = NaN;
        endif
        numarr(! emptr(irowt:irowb, icoll:icolr)) = ...
               cell2mat (rawarr(~emptr(irowt:irowb, icoll:icolr)));

The cell2mat function simply cannot handle the accounting negative number
format.

I am experiencing the problem using Octave 4.2.2 as installed from the Ubuntu
18.04 repositories. However, I checked the latest parsecell.m in the mercurial
repository and the lines of code mentioned above still appear unchanged.





    _______________________________________________________

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]