dot-CallOctave: Calling an Octave Function

Description Usage Arguments Value Examples

Description

.CallOctave calls an Octave function and returns its value.

Usage

1
2
.CallOctave(.NAME, ..., argout = -1, unlist = !is.character(argout),
  buffer.std = -1L, verbose = NULL, plot = getOption("Octave.plot", TRUE))

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).

plot

indicates if the plotting window should be redrawn after executing the command.

If TRUE, then the Octave function drawnow is called. If a character string, then it specifies a path where to save the plot, using the Octave function print. If a list, then the first element is assumed to be a path where to save the plot, and the second element options passed to Octave function print.

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 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'))

renozao/RcppOctave documentation built on May 27, 2019, 5:52 a.m.