Learn R Programming

RcppOctave (version 0.18.1)

.CallOctave: Calling an Octave Function

Description

.CallOctave calls an Octave function and returns its value.

Usage

.CallOctave(.NAME, ..., argout = -1, unlist = !is.character(argout), buffer.std = -1L, verbose = NULL)

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 when their number can be determined. This would typically be the case for functions defined in .m files. Please do read section Details for considerations about the functions that use varargout.
  • only the first one otherwise.

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.
buffer.std
logical that indicates if Octave stdout and/or stderr should be buffered. If TRUE output/errors/warnings are all displayed at the end of the computation. If FALSE they are directly displayed as they come. It is also possible to selectively buffer either one of stdout or stderr, via the following integer codes:
  • 0: no buffering;
  • 1 or -2: only stdout is buffered;
  • 2 or -1: only stderr is buffered;
  • 4 or -3: only warnings are buffered;
  • 7: all messages are buffered.

Note that warnings are handle slightly differently than other messages, as they are never output directly, except when buffer.std = 0.

verbose
logical that toggles verbosity (i.e. debug) messages. If NULL, then the current verbosity level is used (see octave_verbose).

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