Difference between revisions of "Octave"

From UCT EE Wiki
Jump to navigation Jump to search
Line 10: Line 10:
  
 
= Use =
 
= Use =
 +
For full details on how to use Octave, visit [https://octave.org/doc/interpreter/Introduction.html An Introduction to Octave]. The [https://octave.org/doc/v4.0.1/index.html full Octave Documentation] is also available online.
 +
 +
If you're following a guide and get a "function undefined" error from a built-in function, the function may have been deprecated. For a list of deprecated functions, visit [https://octave.org/doc/interpreter/Obsolete-Functions.html Octave Obsolete Functions].
 
== The IDE ==
 
== The IDE ==
 +
[[File:Octave IDE.png|thumb|none|The Octave IDE on Start Up (Windows)]]
 +
 +
=== Path ===
 +
When a function is called, Octave searches a list of directories for a file that contains the function declaration. This list of directories is known as the load path. By default the load path contains a list of directories distributed with Octave plus the current working directory. To see your current load path, you can run <code>path()</code> in the Command Window.
 +
 +
If you are working on your own project in a separate directory, you either need to ensure Octave is in that current working directory by using the "Current Working Directory" drop down at the top left of the window, or manually add it to your path by running <code>addpath("<path>")</code> in the Command Window.
 +
 +
=== Command Window ===
 +
The Command Window is what is usually shown on start up. Here you can call your script files that are on the path, or run some simple commands.
  
 
=== Editor ===
 
=== Editor ===
=== Command Window ===
+
 
 +
 
 +
 
 +
 
 
== Packages ==
 
== Packages ==
 
[https://octave.sourceforge.io/ Octave Forge] allows you to install packages to use within Octave.
 
[https://octave.sourceforge.io/ Octave Forge] allows you to install packages to use within Octave.

Revision as of 08:46, 8 February 2020

Octave is an open source MATLAB-like application. More information can be found at the Octave website.

Installation

Use

For full details on how to use Octave, visit An Introduction to Octave. The full Octave Documentation is also available online.

If you're following a guide and get a "function undefined" error from a built-in function, the function may have been deprecated. For a list of deprecated functions, visit Octave Obsolete Functions.

The IDE

The Octave IDE on Start Up (Windows)

Path

When a function is called, Octave searches a list of directories for a file that contains the function declaration. This list of directories is known as the load path. By default the load path contains a list of directories distributed with Octave plus the current working directory. To see your current load path, you can run path() in the Command Window.

If you are working on your own project in a separate directory, you either need to ensure Octave is in that current working directory by using the "Current Working Directory" drop down at the top left of the window, or manually add it to your path by running addpath("<path>") in the Command Window.

Command Window

The Command Window is what is usually shown on start up. Here you can call your script files that are on the path, or run some simple commands.

Editor

Packages

Octave Forge allows you to install packages to use within Octave.

pkg list 
Lists installed packages
pkg install -forge <pkg-name> 
Install a package