Skip to content

Calling R from within Matlab Code

2 messages · Kamyar Hazaveh Hesarmaskan, Duncan Temple Lang

#
Hi,

Does anyone know how I can call R from within Matlab and return the result 
to Matlab?

Thanks,
Kamyar
1 day later
#
As far as I am aware, there is no package that currently does this.
Some people (Friedrich Leisch and others in Vienna) are working on
using XML to communicate between the two systems.

I am in the process of putting together an R-Octave interface
which allows one to call R from Octave. An R-Matlab interface
would be relatively easy to construct by adapting the R-Octave
code in a few spots. I have looked at embedding R in Matlab
over the past few years and it appears that there are enough
hooks for this.

In principal, all you need to do is create R as a shared library
and then dynamically load some code into Matlab that is linked
against that and which creates R expressions  to be evaluated
from Matlab calls. Many of the Omegahat packages do this, so example
code is available.

I'll hopefully make the R-Octave code available in the next few weeks.
Kamyar Hazaveh Hesarmaskan wrote: