MATLAB Rlink
by
Robert Henson
01 Jun 2004
(Updated
23 Jul 2013)
Functions for calling the statistical package R from within MATLAB.

Rdemo.m 
%% Connecting MATLAB to R
% The statistical programming language R has a COM interface. We can use
% this to execute R commands from within MATLAB.
%% Connect to an R Session
openR
%% Push data into R
a = 1:10;
putRdata('a',a)
%% Run a simple R command
b = evalR('a^2')
%% Run a series of commands and grab the result
evalR('b < a^2');
evalR('c < b + 1');
c = getRdata('c')
%% Close the connection
closeR


Contact us