. About this package {R.matlab} | R Documentation |
This package provides methods to read and write MAT files. It also makes it possible to communicate (evaluate code, send and retrieve objects etc.) with Matlab v6 or higher running locally or on a remote host. The auxillary Java class provides static methods to read and write Java data types.
In brief, this package provides a one-directional interface from R to Matlab, with communication taking place via a TCP/IP connection and with data transferred either through another connection or via the file system. On the Matlab side, the TCP/IP connection is handled by Java.
The methods for reading and writing MAT files are stable. The R to Matlab interface is less prioritized and should be considered a beta version.
To install this package do
install.packages(c("R.oo", "R.matlab"))
To get the "devel" version, use
install.packages("R.classes", contriburl="http://www.maths.lth.se/help/R/")
To update this package do
update.packages()
This package depends on the R.oo package.
The readMat()
and writeMat()
methods do
not require a Matlab installation.
To connect to Matlab, Matlab v6 or higher is required.
It does not work with Matlab v5 or before.
This is a cross-platform package implemented in pure R.
To get started, see:
A related initiative is RMatlab by Duncan Temple Lang and Omegahat. It provides a bi-directional interface between the R and Matlab languages. For more details, see http://www.omegahat.org/RMatlab/.
Whenever using this package, please cite [1] as
@TECHREPORT{BengtssonH_2005, author = {Bengtsson, Henrik}, title = {{R.matlab} - Local and remote {M}atlab connectivity in {R}}, institution = {Mathematical Statistics, Centre for Mathematical Sciences, Lund University, Sweden}, year = {2005}, type = {{Preprint in Mathematical Sciences (manuscript in progress)}}, note = {[manuscript in progress]}, url = {http://www.maths.lth.se/help/R/R.matlab/}, }
Here is a list of features that would be useful, but which I have too little time to add myself. Contributions are appreciated.
Matlab$createShortcut()
which
creates a Windows shortcut to start the Matlab server
by double clicking it. It should be possible to create
it in the current directory or to the Desktop.
Maybe it is possible to do this upon installation and
even to a Start -> All Programs -> R menu.
who(matlab)
, clear(matlab)
etc.
Can this be done automatically using "reflection", so
that required arguments are automatically detected?
SparseM
package.
"$"
and
"$<-"
, e.g. matlab$A
and
matlab$A <- 1234
. Is this wanted?
Maybe the same for functions, e.g. matlab$dice(1000)
.
Is it possible to return multiple return values?
If you consider implement some of the above, make sure it is not already implemented by downloading the latest "devel" version!
We wish to thank the following people who contributed with valuable feedback, suggestions, and code:
[1] Henrik Bengtsson, R.matlab - Local and remote Matlab connectivity in R, Mathematical Statistics, Centre for Mathematical Sciences, Lund University, Sweden, 2005. (manuscript in progress).
Henrik Bengtsson http://www.braju.com/R/