Changes

Jump to navigation Jump to search

FAQ

89 bytes added, 04:29, 28 July 2017
m
→‎Octave-Forge: Overhaul section improve code example.
== How do install or load all Octave-Forge packages? ==
Do not do it! Really, there is no reason to do this. Octave has manypackages for different needs and is unlikely that you need all ofthem. You either have a small set of required packages, in which caseyou know them by name; or you want them all "just because", in which caseyou don't really need them.
The common misconception is that the more packages one has installedand loaded, the more complete and powerful its Octave installation will be. However, in the same way one would never install all perl modules,ruby gems, python packages, and C++ libraries (because it simply makesno sense), one should not install all Octave packages.
Packages should be installed and loaded selectively. Note that somepackages are meant to shadow core functions changing the way Octave works,and that different packages can have different functions with the same nameleading to unpredictable results. If you really really really want to do load all packages, you can withthe following:  ## WARNING: loading all packages is probably not the solution you are looking for. cellfun (@(x) pkg ("load", x.name), pkg ("list"));
If you really really really want to do load all packages, you can with the following:
<syntaxhighlight lang="octave">
## WARNING: loading all packages is probably not the solution you are looking for.
cellfun (@(x) pkg ("load", x.name), pkg ("list"));
</syntaxhighlight>
== How do I automatically load a package at Octave startup? ==
When Octave starts, it runs the file {{Path|~/.octaverc}}(in your user's home directory). If you want Octave toautomatically load a package, simply add a {{codeline|<code>pkg load pkg-name}}</code> command to it. If the files does not exist, create it.
If you do this, remember that other people may not have Octave configuredto load packages at startup. Therefore, if you write code for others,remember that your programs still need to load the packages they require.
=Octave usage=

Navigation menu