Description Usage Arguments Details Author(s) References See Also Examples
These R functions allow one to invoke an arbitrary
Matlab function from within R, passing R objects as the arguments to the Matlab
function.
The two functions are quite different in the model
used to invoke the call.
.Matlab
uses the more akward Engine API for
interacting with Matlab. It allows access to
Matlab as another process, on a different machine, etc.
but uses strings to evaluate the call and uses the
Matlab workspace to temporarily store the
arguments and results. This has the (small) possibility
of overwriting other values within the workspace and causing
erroneous results.
The .MatlabMexCall
is more direct, invoking
a function directly without having to store values
in the workspace. We can only use this mechanism
however when R was originally accessed from within
a Matlab session, and not when Matlab was embedded
within the R process.
1 2 |
funcName |
a string giving the name of the Matlab function to invoke |
... |
the R values that are used as arguments to the Matlab function.
These elements can be named or not. Any named elements are assigned
to the Matlab workspace and will be available in subsequent
calls to For |
.values |
this is an alternative way to specify the arguments to the Matlab function. This is useful in programmatic (i.e. non-interactive) access to this function where one alread has the arguments in a list. |
engine |
a |
.convert |
a logical value indicating whether to convert the result(s) to R objects or leave them as references to Matlab variables. Note that we could (and probably will) just use .resultNames to encode all the possible options of convert or not, or supress all results. |
.resultNames |
if specified, this can be either a number indicating how many values are expected (since Matlab can return multiple values) or the names of the variables in the Matlab workspace to use for storing the results. |
.nout |
an integer iving the number of results that are to be returned from the Matlab function. Since Matlab functions can have more than one return value, this is a way to specify in how many we are interested. |
Currently, this uses an akward mechanism via the Matlab engine API to evaluate the function call rather than doing it directly in the C code.
Duncan Temple Lang <duncan@wald.ucdavis.edu>
Matlab External Interface Guide, the Engine API. Matlab User's Guide
.MatlabInit
.MatlabEval
.MatlabGet
.MatlabPut
1 2 3 4 | ## Not run:
.Matlab('magic', 4)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.