From the official website:
- GNU Octave is a high-level interpreted language, primarily intended for numerical computations. It provides capabilities for the numerical solution of linear and nonlinear problems, and for performing other numerical experiments. It also provides extensive graphics capabilities for data visualization and manipulation. Octave is normally used through its interactive command line interface, but it can also be used to write non-interactive programs. The Octave language is quite similar to Matlab so that most programs are easily portable.
- 1 Installation
- 2 Octave-Forge
- 3 Plotting
- 4 Graphical interfaces
- 5 Reading Microsoft Excel Spreadsheets
- 6 Troubleshooting
Packages can be installed directly in Octave, or from the AUR. See below.
Using Octave's installer
Packages can be managed using Octave's installer. They are installed to ~/octave, or in a system directory with the -global option. To install a package:
octave:1> pkg install -forge packagename
To uninstall a package:
octave:3> pkg uninstall packagename
Some packages get loaded automatically by Octave, for those which do not:
octave:4> pkg load packagename
octave:5> pkg load all
To see which packages have been loaded use
pkg list, the packages with an asterisk are the ones that are already loaded.
A way to make sure that all packages gets loaded at Octave startup:
## System-wide startup file for Octave. ## ## This file should contain any commands that should be executed each ## time Octave starts for every user at this site. pkg load all
Using the AUR
Octave has two official plotting backends:
- Gnuplot — A classic Linux plotting utility.
- FLTK Backend — A new experimental OpenGL backend based on the FLTK GUI toolkit.
FLTK is now the default plotting utility, but due to some serious problems with the experimental interface, you may want to re-enable gnuplot.
To make this change permanent add it to your
Since Octave 3.8, Octave has its own (experimental) GUI based on Qt. Since the 4.0.0 release, it is enabled by default. To start the GUI, just run
The following GUIs are unofficial.
- Cantor — A graphical user interface that delegates its mathematical operations to one of several back ends (Scilab, Maxima, Octave and others).
- QtOctave — A Qt frontend for Octave.
Bug in Documentation tab
As of Octave version 3.8.1, clinking a link in the Documentation tab of the official GUI causes the GUI to freeze. According to bug report #38305, this is caused by a signal handler conflict between Octave and Qt.
One workaround is to unzip the Octave Info files located at
/usr/share/info/octave.info* with the command:
# gunzip /usr/share/info/octave.info*
Another option is to ignore the Documentation tab and use a different Info reader.
Reading Microsoft Excel Spreadsheets
There are several ways to read Microsoft Excel files with Octave.
Converting to an open format
The easiest way to use
.xls files in Octave would be to convert them to
.ods using Calc (limited to 1024 columns) from LibreOffice or Sheets(limited to 32768 columns) from the the Calligra Suite.
After the conversion is complete you can use the build-in Octave function
.ods files the AUR package is necessary which contains the
xlsx2csv -t /path/to/save/location -x /path/to/myfile.xlsx
Reading xls files directly from Octave
If you must work with XLS files and you cannot convert them to CSV or ODS, for whatever reason, you can use the
xlsread function from the AUR package.
SinceAUR version 1.2.5., an interface called 'OCT' was added, which perform reading .xlsx (not .xls!), ods and .gnumeric without any dependencies. However, the Java-based interface still exist (special for reading .xls files and writing those file formats).
Steps necessary to make Java Interface available
The steps necessary to make it work are:
- 2. Install a Java XLS library for
xlsread. There are more such libraries available, a comparison can be found at here. The recommended library is AUR, available in the AUR.
To check if Java is working correctly in Octave, see the output of:
octave:1> javaclasspath STATIC JAVA PATH - empty - DYNAMIC JAVA PATH - empty -
To load the selected library in Octave, check if it is in the Java path. If not:
octave:1> javaaddpath path/to/file.jar
In the case you chose
To check if it works
The output 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)
To make this permanent add the
javaaddpath commands to your
Zsh Undecodable Token
If you get error
undecodable token: b(hex)[23m
when printing, installand relogin.