Learn R Programming

RcppOctave (version 0.9.5)

.CallOctave: Calling an Octave Function

Description

.CallOctave calls an Octave function and returns its value.

Usage

.CallOctave(.NAME, ..., argout = -1,
    unlist = !is.character(argout))

Arguments

.NAME
an Octave function name. The function must be a valid function name in the current Octave session.
...
arguments passed to the Octave function
argout
the number of output values, or a vector of names to use as output variable names. The names are directly used and applied to the result list in their original order.

The default value argout=-1 returns:

  • all output values whe

unlist
a logical that specifies if an output list of length one should be simplified and returned as a single value or kept as a list. The default is to unlist unless output names were passed in argout.

Value

  • the value returned by the Octave function -- converted into standard R objects.

Examples

Run this code
# data matrix
x <- matrix(1:9, 3)

# call Octave function 'svd': equivalent to [S] = svd(x). See o_help(svd)
.CallOctave('svd', x)

# call Octave function 'svd' asking for 3 output values: [U, S, V] = svd(x)
.CallOctave('svd', x, argout=3)

# call Octave function 'svd' asking for 3 named output values: [U, S, V] = svd(x)
.CallOctave('svd', x, argout=c('U', 'S', 'V'))

Run the code above in your browser using DataLab