Difference between revisions of "Octave"

From ArchWiki
Jump to navigation Jump to search
(Created page with "Octave is a high-level language, primarily intended for numerical computations == Installation == {{Pkg|octave}} can be installed from the [[Officia...")
(No difference)

Revision as of 16:00, 13 May 2012

Octave is a high-level language, primarily intended for numerical computations


octave can be installed from the official repositories.


Extra packages for GNU Octave can be find in Octave-Forge. They are comparable like toolboxes in Matlab. Some may be find in AUR: OctaveAUR. For those who don't exist in AUR, you got two options.

1. Feel free to build an PKGBUILD for the missing extra package. (recommended & costlier)

2. Download the tar.gz package from Octave-Forge and install it directly with octave. (Just a userspace installation)

 octave:1> pkg install package_file_name.tar.gz


There are several ways to read Microsoft Excel files with Octave.

Converting (recommended)

Open the xls/xlsx file with LibreOffice (Is limited to 1024 Columns!)/CalligraOffice (Is limited to 32768 Columns)/... and save/export it as a .csv file. Octave-core has a built-in function called csvread.

 octave:2> csvread('myfile.csv');

Otherwise you can save/export as .ods file, and import it with octave using the octave-ioAUR package.

 octave:3> odsread('myfile.ods');

Another try if Office Suits are failing is xlsx2csvAUR from AUR to convert the xlsx file to csv file.

 xlsx2csv -t where/to/save/ -x mylousy.xlsx 

Reading directly xls file with Octave

If converting to .csv/.ods is no option, or don't work, Octave is able to read xls files using octave-ioAUR package. But xlsread function is needing java.

 pacman -S jdk7-openjdk jre7-openjdk jre7-openjdk-headless

And while octave have to use java, you'll need Octave-Java too.

 octave:4> pkg install java-1.2.8.tar.gz

Finaly, octave-java searches in a wrong folder for libjvm.so

 sudo mkdir /usr/lib/jvm/java-7-openjdk/jre/lib/amd64/client
 sudo ln -s /usr/lib/jvm/java-7-openjdk/jre/lib/amd64/server/libjvm.so /usr/lib/jvm/java-7-openjdk/jre/lib/amd64/client/libjvm.so

Checking if java is working correct in octave, compare the following output

 octave:4> javaclasspath 
     - empty -
     - empty -

Now you'll need Java XLS Libraries. Take one of this: http://octave.org/wiki/index.php?title=IO_package#Required_support_software_2 (recommended poi)

These are the differences: http://octave.org/wiki/index.php?title=IO_package#Comparison_of_interfaces_.26_usage

To load one of them in octave

 octave:5> javaaddpath path/to/file.jar

To check if it works

 octave:6> chk_spreadsheet_support 

return should be > 0

                   0 No spreadsheet I/O support found
                 ---------- XLS (Excel) interfaces: ----------
                   1 = COM (ActiveX / Excel)
                   2 = POI (Java / Apache POI)
                   4 = POI+OOXML (Java / Apache POI)
                   8 = JXL (Java / JExcelAPI)
                  16 = OXS (Java / OpenXLS)
                 --- ODS (OpenOffice.org Calc) interfaces ----
                  32 = OTK (Java/ ODF Toolkit)
                  64 = JOD (Java / jOpenDocument)
                 ----------------- XLS & ODS: ----------------
                 128 = UNO (Java / UNO bridge - OpenOffice.org)

Now you can try to read xls files with

 octave:6> m=xlsread('mylousy.xls');

Maybe it works, may be not... :)