"Octave" (External Evaluation System)


  • GNU Octave is a scientific programming language with powerful mathematics-oriented syntax.
  • Octave Version 4.2.2 and higher is supported.
  • To configure Octave for use in the Wolfram Language, follow the instructions from the Configure Octave for ExternalEvaluate workflow.

ExternalEvaluate Usage

  • ExternalEvaluate["Octave",code] executes the code string in Octave and returns the results as a Wolfram Language expression.

Data Types

  • The following Octave built-in types are supported:
  • logicalTrue | FalseBoolean True/False values
    int8, int16, int32, etc.Integerinteger
    floatRealreal number
    complexComplexcomplex number (returning from Octave only)
    charStringstring of characters
    matrixListlist of objects
    structAssociationassociative array
    cellListvariable container of different size and type
    InfComplexInfinityquantity with infinite magnitude
    NaNIndeterminatenot well defined numerical result


open allclose all

Basic Examples  (1)

Evaluate 2+2 in Octave and return the result:

Arrays are returned as lists:

Type > and select Octave from the drop-down menu to get a code cell that uses ExternalEvaluate to evaluate:


Scope  (11)

Evaluate a Boolean statement in Octave and return the result:

Compute the magnitude of a complex number in Octave and return the result:

Dictionaries in Octave are returned as associations:

Create a Complex number in Octave and return the result:

Session Options  (4)

"ReturnType"  (2)

For the Octave evaluation system, the default return type is "Expression":

Numbers, strings, lists and associations are automatically imported for the "Expression" return type:

"Version"  (1)

You can use "Version" to make sure only a particular Octave version is going to be used:

"Target"  (1)

Evaluate Octave code using a specified "Target":

Command Options  (4)

"Command"  (2)

When only a string of Octave code is provided, the command is directly executed:

The above is equivalent to writing the command using this form:

Put code in a CloudObject:

Evaluate directly from the cloud:

The above is equivalent to writing the command using this form:

"Arguments"  (2)

Use "Arguments" to call the result of the evaluation with arguments:

When a non-list argument is provided, a single argument is passed to the function:

You can define a function inside "Command" and directly call it with "Arguments":

The same result can be achieved by using a Rule:

You can also pass arguments by creating an ExternalFunction:

Applications  (1)

Use an anonymous function in Octave:

Use the function:

Close the session: