Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to load packages in Octave permanently?

I am using Octave on Window vista. I am using 4 package in my code. But every time I restart octave, I have to load manually from command line, 'pkg load ...' Is there a way to load them permanently so that whenever Octave is started it finds them in its path.

like image 719
TonyParker Avatar asked Jun 23 '16 09:06

TonyParker


People also ask

How do I download signal packages in Octave?

To install a package from the Octave Forge, at the Octave prompt type pkg install -forge package_name . This requires an internet connection. If you use a very old Octave version (< 3.4. 0), you'll have to download the package file manually, and use pkg install package_file_name.

What is package in Octave?

Community packages are coordinated between each other and with Octave regarding compatibility, naming of functions, and location of individual functions or groups of functions. See also: external packages, unmaintained packages.


2 Answers

When Octave starts, it runs ~/.octaverc. If you want Octave to automatically load a package, simply add a pkg load pkg-name command to it. If the files does not exist, create it.

If you do this, remember that other people may not have Octave configured to load packages at startup. Therefore, if you write code for others, remember that your programs still need to load the packages they require.

Do not use pkg install -auto ... or pkg rebuild -auto .. because that will stop working on the next Octave release.

like image 119
carandraug Avatar answered Sep 16 '22 11:09

carandraug


I got the answer. It can be set at the time of package installation. install with following command pkg install -auto [package name] It will be load every time octave is started.

like image 44
TonyParker Avatar answered Sep 18 '22 11:09

TonyParker