help-octave
[Top][All Lists]
Advanced

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

Re: cannot read excel file with Octave


From: PhilipNienhuis
Subject: Re: cannot read excel file with Octave
Date: Thu, 20 Jun 2019 13:58:15 -0500 (CDT)

Acturus13 wrote
> Hello, i have found a code on Github written in Matlab. Its not possible
> for
> me to install it so I have downloaded Octave 5.1.0 for windows 7.
> 
> I have managed to load the io package ( I have added the "pkg load io"
> command at the beginning of the code) which seemed to have help but not
> enough.
> 
> in the code load_spec  , there is this line : 
> 
> [~,~,raw] = xlsread(specfile,'','','basic');

yes, "basic" doesn't work without additional SW.


> with specfile being  'Spec_US_example.xls'
> 
> here is the console output:
> 
> (BASIC (BIFF5) support request translated to JXL)
> Checking requested interface(s):
> JXL is not supported.
> error: element number 3 undefined in return list
> error: called from
>     load_spec at line 30 column 11 
> 
> I have read many topics about it but none correspond to my Octave version
> and actually my specific problem. That's why I'm posting.

Did you try "help xlsread"? Somewhere there "JXL" is mentioned in a stanza
that supplies additional info.
But read on...


> I also tried to read an xslx file instead of an xls but to no avail.
> 
> I'm not familiar enough with Matlab syntax to know if there is problem
> with
> the syntax above, or if the problem is coming from elsewhere. 
> 
> I have read that with version above 4, there is no problem linked to Java
> but I may mistaken.
> 
> Thank you for your help

Some background info:
It is hard to get a completely Matlab-compatible xlsread because Matlab
invokes Excel behind the scenes. Excel is proprietary SW; invoking it by
Octave (using ActiveX/COM system libraries on Windows) is frowned upon by
some people here, and invoking Excel directly doesn't work on MacOS and
Linux. In addition, the way Matlab does it leaves much to be desired.

To make xlsread more platform-independent (at the cost of some
Matlab-compatibility) a number of choices had to be made. To name a few:
- A choice of "interfaces", or additional external SW instead of Excel to
read spreadsheet files, several based on Java "libraries"
- There is a native Octave "interface" (OCT) that doesn't invoke external SW
but it can only read .xlsx, .ods and .gnumeric but no .xls. To invoke it
leave out the "basic" parameter.
- Returned date/time formats differ between interfaces, little to be done
about that
- and there's a few more.

To get you started, download jxl.jar (google for it) and add it to the
javaclasspath:
javaaddpath ('/full/path/to/jxl.jar')
and then (provided you load the io package) you can read .xls files with
xlsread.
(There are alternatives for jxl.jar but they are more complicated.)

Anyway you point me to some deficiencies in the docs. I'll try to
fix/clarify those docs.

Philip



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html



reply via email to

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