[R] calling Matlab
Duncan Temple Lang
duncan at research.bell-labs.com
Wed Jul 24 22:47:42 CEST 2002
I have looked at this several times over the years and not had any
compelling necessity to implement the S-Matlab bridge. However, just
last week I was looking at connecting R to Octave. And Matlab does
provide similar eval()-like functionality for calling its functions
from C code. It would be nice to have R graphics within Octave and
have the entire domain of functionality that Octave provides and R
Getting the elementary connection that covers primitive types is quite
easy and covers much of what is needed. However, non-primitive objects
in either system don't necessarily have equivalents in the other (e.g,
formula, and even data.frame). As part of the Omegahat project, we
have developed a general bi-directional model for inter-system
interfaces that handles both primitive and non-primitive types in a
consistent and flexible fashion. We have used for creating connections
an equivalent setup for aspects of C/C++ (i.e. the automated/dynamic
reflectance approach). I may get time to do the Octave version in
September or so. However, if someone is going to work on this, it
might be useful to look at RSPython, for example. I'd be happy to
provide more details.
Timothy H. Keitt wrote:
> Once the world realizes the importance of a common runtime engine, this
> will all be child's play. You'll just attach your matlab and R sessions
> to the same resource pool and each will see the other's data. Data
> storage and representation issues should be an OS (really common
> middleware) service; why we keep rewriting it all from scratch is beyond
> That said, it would be strait forward to write a matlab-compatible
> module that call R's eval in C code. Going the other way might be also
> easy, but I can't remember how and if matlab exports its header files.
> But its probably easier still (although not elegant) to dump ascii files
> from matlab and load them in R.
> On Wed, 2002-07-24 at 11:50, Brian Scholl wrote:
> > To clarify, based on the other responses that I've gotten: I already have a
> > version of Matlab on my pc (it's the student version, but it does what I
> > need - I've been thinking to buy the complete version as well if I can rob a
> > bank sometime soon) and I've got Gauss code I wrote when I was working on
> > that system for the computation, say, of GMM models. Anyway, Barry Quinn's
> > recent Estimation and Tracking of Frequency book has some great matlab code
> > and there are many programs that I've written on my own that are just a pain
> > to do over again in R. The main problem is that I'd like to be able to
> > easily transfer data back and forth between the two systems in code (and
> > maybe call a few of my matlab routines in R too).
> > For example (in case I'm babbling), I might compute the periodogram using R,
> > then use Chiu's (1989) procedure I'd determine peaks. Using those
> > frequencies I could estimate a sum-of-cosines regression in Matlab very
> > easily and nicely using Quinn's code, which would then give me the residuals
> > from the regression, the periodogram of which I could plot very nicely in R.
> > I'd love to do all this without 1. saving + loading the data umpteen times
> > manually (then running the code on the respective systems in sequence); or
> > 2. reprogramming everything in R or Matlab.
> > Thank you for all your help.
> > Brian
> > ----- Original Message -----
> > From: "Liaw, Andy" <andy_liaw at merck.com>
> > To: "'Brian Scholl'" <scholl at yubc.net>; "Rhelp questions list"
> > <r-help at stat.math.ethz.ch>
> > Sent: Wednesday, July 24, 2002 2:59 PM
> > Subject: RE: [R] calling Matlab
> > > Both Matlab and Gauss are proprietary software. Even before considering
> > the
> > > technical possibility of such link, you may want to read the license
> > > agreements for those packages and see if it's even legal to do so.
> > >
> > > Just my $0.02...
> > > Andy
> > >
> > > > -----Original Message-----
> > > > From: Brian Scholl [mailto:scholl at yubc.net]
> > > > Sent: Tuesday, July 23, 2002 6:41 AM
> > > > To: Rhelp questions list
> > > > Subject: [R] calling Matlab
> > > >
> > > >
> > > > Is there a way to call Matlab and Gauss code in R? I see
> > > > functions that
> > > > work for C/FORTRAN, but not for other languages.
> > > >
> > > > Brian
> > > >
> > > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
> > > > -.-.-.-.-.-.-.-.-
> > > > r-help mailing list -- Read
> > > > http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> > > > Send "info", "help", or "[un]subscribe"
> > > > (in the "body", not the subject !) To:
> > > > r-help-request at stat.math.ethz.ch
> > > > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
> > > > _._._._._._._._._
> > > >
> > >
> > > --------------------------------------------------------------------------
> > ----
> > > Notice: This e-mail message, together with any attachments, contains
> > information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that
> > may be confidential, proprietary copyrighted and/or legally privileged, and
> > is intended solely for the use of the individual or entity named on this
> > message. If you are not the intended recipient, and have received this
> > message in error, please immediately return this by e-mail and then delete
> > it.
> > >
> > >
> > ============================================================================
> > ==
> > >
> > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> > Send "info", "help", or "[un]subscribe"
> > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
> > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
Duncan Temple Lang duncan at research.bell-labs.com
Bell Labs, Lucent Technologies office: (908)582-3217
700 Mountain Avenue, Room 2C-259 fax: (908)582-3340
Murray Hill, NJ 07974-2070
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help