Difference between revisions of "Octave"
(→Reading Microsoft Excel Spreadsheets: update usage and facts) |
(→Plotting: update) |
||
(32 intermediate revisions by 16 users not shown) | |||
Line 1: | Line 1: | ||
[[Category:Mathematics and science]] | [[Category:Mathematics and science]] | ||
− | + | [[ja:Octave]] | |
− | + | {{Related articles start}} | |
− | {{ | + | {{Related|Matlab}} |
− | {{ | + | {{Related|Sage-mathematics}} |
− | {{ | + | {{Related|Mathematica}} |
− | {{ | + | {{Related articles end}} |
− | {{ | + | |
From the [http://www.gnu.org/software/octave/ official website]: | From the [http://www.gnu.org/software/octave/ official website]: | ||
Line 12: | Line 12: | ||
== Installation == | == Installation == | ||
− | + | [[Install]] the {{Pkg|octave}} package. | |
− | + | Run the GUI app with ''octave'' or the CLI app with ''octave-cli''. | |
− | + | === Alternative graphical interfaces === | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | The default ''octave'' GUI is included in the {{Pkg|octave}} package. Alternatively, you can use one of the following unofficial GUIs: | |
+ | * {{App|Cantor|A graphical user interface that delegates its mathematical operations to one of several back ends (Scilab, Maxima, Octave and others).|http://edu.kde.org/cantor/|{{Pkg|cantor}}}} | ||
+ | * {{App|QtOctave|A Qt frontend for Octave.|https://forja.rediris.es/projects/csl-qtoctave/|{{AUR|qtoctave}}}} | ||
+ | |||
+ | == Octave-Forge == | ||
− | + | Octave provides a set of packages, similar to Matlab's Toolboxes, through [http://octave.sourceforge.net/index.html Octave-Forge]. The complete list of packages is [http://octave.sourceforge.net/packages.php here]. | |
− | + | Packages can be installed [[#Using Octave's installer]] or [[#Using the AUR]]. | |
=== Using Octave's installer === | === Using Octave's installer === | ||
− | Packages can | + | 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 | |
− | + | ||
− | + | {{Note|Some Octave's packages, like {{ic|control}}, need the {{Pkg|gcc-fortran}} ArchLinux's package in order to compile and install.}} | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
To uninstall a package: | To uninstall a package: | ||
− | octave:3> pkg uninstall packagename | + | octave:3> pkg uninstall packagename |
Some packages get loaded automatically by Octave, for those which do not: | Some packages get loaded automatically by Octave, for those which do not: | ||
Line 65: | Line 59: | ||
## time Octave starts for every user at this site. | ## time Octave starts for every user at this site. | ||
pkg load all}} | pkg load all}} | ||
+ | |||
+ | === Using the AUR === | ||
+ | |||
+ | Some packages may be found in the AUR ([https://aur.archlinux.org/packages.php?O=0&K=octave-&do_Search=Go search packages]). New Octave-forge packages for Arch can be created semi-automatically using the [https://github.com/drizzd/octave-forge-archlinux#readme Octave-forge helper scripts for Archlinux]. | ||
== Plotting == | == Plotting == | ||
− | + | FLTK is the default plotting backend. Alternatively you can use the Gnuplot backend by installing {{Pkg|gnuplot}} and running the following command: | |
− | + | ||
− | + | ||
− | + | ||
− | + | octave:1> graphics_toolkit("gnuplot"); | |
− | + | ||
− | octave:1> graphics_toolkit(" | + | |
To make this change permanent add it to your {{ic|~/.octaverc}} file. | To make this change permanent add it to your {{ic|~/.octaverc}} file. | ||
− | == | + | == Reading Microsoft Excel Spreadsheets == |
− | + | You can open {{ic|.ods}}, {{ic|.xls}} and {{ic|.xlsx}} files with the {{ic|odsread}} or {{ic|xlsread}} function, which requires the {{AUR|octave-io}} package: | |
− | + | ||
− | + | ||
− | + | octave:1> odsread('myfile.ods'); | |
+ | octave:1> xlsread('myfile.xls'); | ||
+ | octave:1> xlsread('myfile.xlsx'); | ||
− | + | === Converting to CSV format === | |
− | + | Alternatively, first convert the files to {{ic|.csv}} using [[LibreOffice]] Calc ([https://bugs.documentfoundation.org/show_bug.cgi?id=50916 limited] to 1024 columns) or [http://www.calligra.org/sheets/ Calligra Sheets] ({{Pkg|calligra}}, limited to 32768 columns). | |
− | + | ||
− | + | ||
After the conversion is complete you can use the build-in Octave function {{ic|csvread}} for {{ic|.csv}} files: | After the conversion is complete you can use the build-in Octave function {{ic|csvread}} for {{ic|.csv}} files: | ||
Line 97: | Line 88: | ||
octave:1> csvread('myfile.csv'); | octave:1> csvread('myfile.csv'); | ||
− | + | == Troubleshooting == | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | ==== | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | === Zsh Undecodable Token === | |
+ | If you get error | ||
+ | undecodable token: b(hex)[23m | ||
+ | when printing, install {{Pkg|grml-zsh-config}} and relogin. |
Latest revision as of 16:40, 15 January 2017
Related articles
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.
Contents
Installation
Run the GUI app with octave or the CLI app with octave-cli.
Alternative graphical interfaces
The default octave GUI is included in the octave package. Alternatively, you can use one of the following unofficial GUIs:
- 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.
Octave-Forge
Octave provides a set of packages, similar to Matlab's Toolboxes, through Octave-Forge. The complete list of packages is here.
Packages can be installed #Using Octave's installer or #Using the AUR.
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
or
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:
/usr/share/octave/site/m/startup/octaverc
## 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
Some packages may be found in the AUR (search packages). New Octave-forge packages for Arch can be created semi-automatically using the Octave-forge helper scripts for Archlinux.
Plotting
FLTK is the default plotting backend. Alternatively you can use the Gnuplot backend by installing gnuplot and running the following command:
octave:1> graphics_toolkit("gnuplot");
To make this change permanent add it to your ~/.octaverc
file.
Reading Microsoft Excel Spreadsheets
You can open .ods
, .xls
and .xlsx
files with the odsread
or xlsread
function, which requires the octave-io^{AUR} package:
octave:1> odsread('myfile.ods'); octave:1> xlsread('myfile.xls'); octave:1> xlsread('myfile.xlsx');
Converting to CSV format
Alternatively, first convert the files to .csv
using LibreOffice Calc (limited to 1024 columns) or Calligra Sheets (calligra, limited to 32768 columns).
After the conversion is complete you can use the build-in Octave function csvread
for .csv
files:
octave:1> csvread('myfile.csv');
Troubleshooting
Zsh Undecodable Token
If you get error
undecodable token: b(hex)[23m
when printing, install grml-zsh-config and relogin.