Home > chronux_0.5 > locfit_wrap > rlink > Rdemo.m

Rdemo

PURPOSE ^

% Connecting MATLAB to R

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

% Connecting MATLAB to R 
 The statistical programming language R has a COM interface. We can use
 this to execute R commands from within MATLAB.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %% Connecting MATLAB to R
0002 % The statistical programming language R has a COM interface. We can use
0003 % this to execute R commands from within MATLAB.
0004 
0005 %% Connect to an R Session
0006 openR
0007 
0008 %% Push data into R
0009 a = 1:10;
0010 putRdata('a',a)
0011 
0012 %% Run a simple R command
0013 b = evalR('a^2')
0014 
0015 %% Run a series of commands and grab the result
0016 evalR('b <- a^2');
0017 evalR('c <- b + 1');
0018 c = getRdata('c')
0019 
0020 %% Close the connection
0021 closeR

Generated on Tue 16-Aug-2005 21:33:45 by m2html © 2003