Description Usage Details Value Author(s) References See Also Examples
This function returns an object that identifies the interface from R to Matlab. This is either a reference to an internal (i.e. C-level) Matlab Engine object or a regular R object and the class of the object identifies whether the R-to-Matlab interface is using MEX (the direct interface) or the Engine API.
1 |
If the variable .MexInterface
exists
in the R work space (global environment),
then that object is returned.
Otherwise, we access the C code
for this package and return a reference to the
default, or last created, Engine object.
If the MEX interface is being used, this returns
an object of class .MexInterface
.
If the Engine API is being used, this returns
a reference to the internal Engine data structure
and makes it an object of class MatlabEngine
.
Both objects are opaque data types and it is not intended
that the value within the object be used directly in the R code.
Also both objects are of class (or extend) MatlabInterface
and this allows the resulting object to be used with the operator
overloading for $
, [[
, [
and [<-
.
Duncan Temple Lang <duncan@wald.ucdavis.edu>
Matlab External Interface Guide http://www.mathworks.com/access/helpdesk/help/techdoc/apiref/apiref.html The Engine API. Matlab User's Guide
.Matlab
.MatlabMexCall
.MatlabInit
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## Not run:
e = getMatlabInterface()
# Asssign the vector in R to the Matlab variable "a"
e["a"] <- 1:3
# Assign the two R objects in the list to variables in Matlab.
e["b", "xyz"] <- list(rnorm(10), letters)
# Retrieve the value of the Matlab variable "a"
e[["a"]]
# Retrieve the value of the two Matlab variables "b" and "xyz"
e["b", "xyz"]
# Call the Matlab function magic
e$magic(3)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.