"Octave" (External Evaluation System)

Details

  • 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

Examples

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:

cos([pi,0])

Scope  (2)

Start a session:

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

Dictionaries in Octave are returned as associations:

Close the session:

Start a session:

Define a function in Octave:

Call the function using ExternalFunction:

Define an anonymous function:

Call the function:

Close the session: