Porting to Octave

From Bangor Imaging Unit

Getting Started

Packages

Packages are extensions to Octave. Functionally packages are similar to MATLAB's toolboxes. Some functions found in core MATLAB are in Octave packages.

To see what packages are installed type

pkg list

at an Octave prompt. Available packages will have an asterisk after the Package Name in the listing. By default installed packages are not available. To add a package to Octave's search path

pkg load  

A full list of maintained packages is at https://octave.sourceforge.io/packages.php.

To install a package not on your computer type

pkg install -forge package_name
pkg load package_name

Please please please do not install packages on the stimulus computer without testing elsewhere first!

io

You are probably here because you need to read an Excel or .csv file. The io package can read / write Excel, csv, Open Office and some other file types. This package installs along with Octave but it isn't configured for use. First, check that it really is installed. At an Octave prompt type:

pkg list

You should see io in the output listing. If not, your distribution is broken or someone removed the package. See above for how to install a package. If io has an asterisk after the name, the package is loaded into the search path. If it isn't type:

pkg load io

Next, use chk_spreadsheet_support.m to see how much of io is working. The io package wraps around a variety of interfaces. To get xlsread working, you don't need all of io working. I'm not sure if it is even possible to get everything to work on Ubuntu.

chk_spreadsheet_support("",3)

and see what comes back. You probably just need to set Octave's static javaclasspath to point at things that are already installed as part of Ubuntu. Look for javaclasspath.txt in /usr/share/octave/ ( version number ) /m/java/ . If that file exists, it sets the class path for all users. If it doesn't it is safest to create a new one in your home directory.

Add the following to javaclasspath.txt in your home directory:

/usr/share/java/poi-3.10.1.jar
/usr/share/java/poi-ooxml-3.10.1.jar
/usr/share/java/poi-excelant.jar
/usr/share/java/poi-ooxml-schemas.jar
/usr/share/java/poi-scratchpad.jar
/usr/share/java/xmlbeans.jar
/usr/share/java/dom4j.jar
/usr/share/java/jxl.jar
/usr/share/java/jOpenDocument-1.3.jar
/usr/share/java/unoil.jar
/usr/share/java/jurt.jar
/usr/share/java/juh.jar
/usr/share/java/unoloader.jar
/usr/share/java/ridl.jar

Restart Octave and try chk_spreadsheetsupport again. Most of io should be working.