Install packages in GNU Octave
GNU Octave can install third-party packages in a friendly way, analogous to the Matlab App Store or how Linux repositories work. Regardless of operating system, Octave can install these extension packages from the Octave command line. Some packages require a compiler or libraries. If package install fails, read the log output to see if installing a system library is required.
Packages are installed at the Octave command prompt, and download automatically.
Prereqs are not automatically installed, but messages are given telling which package needs to be installed first.
signal
is a perfect example of this, given below.
“signal” is a popular Octave package, which brings many functions found in Matlab’s DSP and Communications Toolbox.
We’ll see that signal
needs other packages first; let’s walk through the Octave signal
install.
All commands are from Octave command prompt.
Try using a command that requires signal
diric(0.2, 5)
warning: the ‘diric’ function belongs to the signal package from Octave Forge which seems to not be installed in your system.
If I had already installed signal
, but forgotten to load it since I started Octave, the error would have been:
warning: the ‘diric’ function belongs to the signal package from Octave Forge which you have installed but not loaded.
Install signal
Octave package from Octave prompt:
pkg install -forge signal
The -forge
option indicates to use the
Octave-Forge repo
for automatic download.
This returns a warning saying that control
is required.
Install control
:
pkg install -forge control
this requires the gfortran
compiler.
pkg install -forge signal
Use Octave packages in a Matlab-compatible way simply by enclosing in try
end
function d = twicediric(x)
try
pkg load signal
end
d = 2*diric(x)
end
If the package isn’t installed, the message on reaching the missing function tells which package is needed.