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

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

[Octave-bug-tracker] [bug #45498] Minor bugs with xlswrite from package


From: anonymous
Subject: [Octave-bug-tracker] [bug #45498] Minor bugs with xlswrite from package io-2.2.8
Date: Wed, 08 Jul 2015 20:10:10 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko

URL:
  <http://savannah.gnu.org/bugs/?45498>

                 Summary: Minor bugs with xlswrite from package io-2.2.8
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Mi 08 Jul 2015 20:10:04 UTC
                Category: Octave Forge Package
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.0.0
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

xlswrite can be used after installing the io-package with:

pkg install io-2.2.8.tar.gz

The io-2.2.8.tar.gz file has to be located in the Octave working directory.
Then 

pkg load io 

has to be entered. 
The following bugs with xlswrite are observed:

1)   writing a second Excel-sheet to an existing file with
     xlswrite('filename.xlsx', arr, 2, 'B2:Z100') 
will result in an error. If filename.xlsx does not exist, the Excel-file is
created with "Sheet2" as first table. In order to add a second sheet to an
existing file, the sheet-name has to be written explicitly with  apostrophes:

     xlswrite('filename.xlsx', arr, 'Sheet3', 'B2:Z100')

2)   Small numbers in array arr will lose precision, when written to the
Excel-file. Numbers below 1e-12 are written as 0 to the file. For an array of
small numbers all information is lost.

3)   When an Excel-file is newly created by xlswrite it must not exist. An
error results, if an Excel file, e.g. 'filename.xlsx', exists in the starting
directory of the Octave-run, although the program has changed to a
sub-directory where no such file exists and where the file has to be created.

  
Here is an example of program execution with Octave 4.0.0 for bug 1): 

>>  arr=rand(3,4); xlswrite('filename.xlsx',arr,1,'B2:Z100')
Detected XLS interfaces: ans =  1

>>  xlswrite('filename.xlsx', arr, 2, 'B2:Z100')
error: 'string' undefined near line 127 column 19
error: called from
    __OCT_oct2xlsx__ at line 127 column 7
    __OCT_oct2spsh__ at line 74 column 18
    oct2xls at line 207 column 18
    xlswrite at line 218 column 20
error: evaluating argument list element number 1
error: called from
    __OCT_oct2xlsx__ at line 127 column 7
    __OCT_oct2spsh__ at line 74 column 18
    oct2xls at line 207 column 18
    xlswrite at line 218 column 20


An example for bug 2) is provided below:

arr=rand(3,4); xlswrite('filename.xlsx',arr,1,'B2:Z100')
xlswrite('filename.xlsx', arr*1e-4, 'Sheet2', 'B2:Z100')
xlswrite('filename.xlsx', arr*1e-12,'Sheet2', 'B6:Z100')

This sequence of commands leads to an Excel file 'filename.xlsx' with the
original array arr in Sheet1 and scaled arrays arr with lost precision in
Sheet2.


In order to be compatible with Matlab syntax, it would also be desirable not
to restrict the array to the cell region specified in xlswrite. E.g. in Matlab
xlswrite('filename.xlsx',arr,1,'B2') writes the full array arr starting at B2
as upper left cell. Octave only writes the first element of arr to B2.
However, different program runs can create different sizes of array arr. In
that case the Matlab syntax is more convenient. As a workaround it is 
possible in Octave to give a cell region larger than the extension of arr, but
this does not lead to a generally valid programming technique. 




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?45498>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.gnu.org/




reply via email to

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