Installing Octave signal package

I am on Ubuntu 16.04 and am currently using Octave as a backend to Matlab for signal processing. Everything was fine until I needed to use a function medfilt1

to get the median. Octave generated an error report indicating that the signal package is not installed on my system. After browsing for a bit, I found the command

 sudo apt-get install octave-signal

      

I ran this command and it showed everything downloaded and installed fine. However, if I run the octave script again, the error persists:

warning: the "medfilt1" feature belongs to the Octave Forge signal package that you installed but did not download. To load a package, run 'pkg load signal' from the Octave prompt.

Read http://www.octave.org/missing.html to find out how you can contribute missing functionality. warning: caused by      unimplemented on line 524, column 5 filter-practice.m on line 8 column 2 error: "medfilt1" undefined near line 8 column 3 Error: call from filter-practice.m on line 8 column 2

Analyzing the error message, I tried to run it pkg load signal

, but the terminal told me that there was no such command.

command not found: pkg

How can I get the signaling package installed on my system?

+3


source to share


2 answers


The command pkg

is actually part of the octave and should be run from the octave and not from the shell terminal.




Credit for this answer goes to members of this thread , but since they similarly came to their conclusion in extended comments and haven't finished posting the answer, maybe this will find some others falling into this trap :)

+4


source


I'll give an answer here for future users, although the post already has an accepted answer as it misses all the necessary information (if you're only interested in how to install a package via apt -get to appear in your octave session see the bit at the end) ...

To install one of the packages listed in Octaveforge (see here for a complete list of available packages), you can download the file .tar.gz

for a specific package from your respective page (for example, here for a package signal

) and then go to that folder and run the following command on octave terminal:

pkg install signal

      

Alternatively and much more conveniently, you can ask Octave to download the package directly from Octaveforge and install it by adding the parameter -forge

:

pkg install signal -forge

      

You can also specify where to install such packages if you don't like the default location (usually ~/octave

) using the command pkg prefix

before installing the package (see the documentation for details).

After installing a package, you can query the list of installed packages using the command pkg list

; "downloaded" packages are marked with an asterisk, for example on my PC.

octave:1> pkg list
Package Name         | Version | Installation directory
---------------------+---------+-----------------------
fuzzy-logic-toolkit  |   0.4.5 | /media/tasos/Gandalf/opt/octave-4.2.1/lib/fuzzy-logic-toolkit-0.4.5
              image *|   2.6.1 | /media/tasos/Gandalf/opt/octave-4.2.1/lib/image-2.6.1
                 io  |   2.4.7 | /media/tasos/Gandalf/opt/octave-4.2.1/lib/io-2.4.7
         statistics  |   1.3.0 | /media/tasos/Gandalf/opt/octave-4.2.1/lib/statistics-1.3.0

      



To download a package, use the command pkg load

; any "dependencies" will also be loaded automatically, for example:

octave:2> pkg load statistics
octave:3> pkg list
Package Name         | Version | Installation directory
---------------------+---------+-----------------------
fuzzy-logic-toolkit  |   0.4.5 | /media/tasos/Gandalf/opt/octave-4.2.1/lib/fuzzy-logic-toolkit-0.4.5
              image *|   2.6.1 | /media/tasos/Gandalf/opt/octave-4.2.1/lib/image-2.6.1
                 io *|   2.4.7 | /media/tasos/Gandalf/opt/octave-4.2.1/lib/io-2.4.7
         statistics *|   1.3.0 | /media/tasos/Gandalf/opt/octave-4.2.1/lib/statistics-1.3.0

      


The above methods are considered local installations. Octave keeps a list of installed packages in files named octave_packages

, which are usually found either in your octave installation or in your home folder. In case you installed packages globally from the repository instead , you will need to specify the octave by linking the corresponding file octave_packages

, usually /usr/share/octave/octave_packages

using the command pkg global_list

.

For example, I had to install odepkg

from the repositories because the direct option above gave me an error. For it to appear in the list of available packages in octave, you must indicate the presence of such globally installed pkgs:

octave:4> pkg global_list /usr/share/octave/octave_packages 
octave:5> pkg list
Package Name         | Version | Installation directory
---------------------+---------+-----------------------
fuzzy-logic-toolkit  |   0.4.5 | /media/tasos/Gandalf/opt/octave-4.2.1/lib/fuzzy-logic-toolkit-0.4.5
              image *|   2.6.1 | /media/tasos/Gandalf/opt/octave-4.2.1/lib/image-2.6.1
                 io *|   2.4.7 | /media/tasos/Gandalf/opt/octave-4.2.1/lib/io-2.4.7
             odepkg  |   0.8.5 | /usr/share/octave/packages/odepkg-0.8.5
         statistics *|   1.3.0 | /media/tasos/Gandalf/opt/octave-4.2.1/lib/statistics-1.3.0

      

However, it is usually more convenient to install such packages locally, since the versions of packages in the repositories are often outdated (and having to do it pkg global_list

every time is a hassle); I would only install global packages from the linux terminal if the local octave install doesn't work for some reason (gives compilation errors for example).

See the documentation for the command for details by pkg

executing help pkg

in octave terminal.

+6


source







All Articles