Calling R from Matlab

20 views (last 30 days)
Dusanka
Dusanka on 9 Apr 2012
Hi all,
These are the general instructions I followed to interface Matlab and R: http://www.mathworks.com/matlabcentral/fileexchange/5051
This is the error I get when trying to verify statconnDCOM: Loading StatConnector Server... Done Initializing R...Function call failed Code: -2147221485 Text: installation problem: unable to load connector Releasing StatConnector Server...Done
Otherwise, when I say in Matlab, e.g., openR I get this error: ??? Error using ==> openR at 68 Cannot connect to R. Error: Object returned error code: 0x80040013
I tried every possible advice that I've found online (e.g. made sure that all the installed files are in Matlab path). It looks like my R version is not compatible with the online offered tools, but it seems impossible that no one is using new version of R within Matlab. I am wondering if you can help.
I am using the latest R version and Student version of Matlab.
My goal is to run R functions from Matlab.
%========================================
I hope this helps someone help me. :)
Thanks!
%===================================================
Duska
  1 Comment
Shimin
Shimin on 31 Jul 2012
This problem is mostly caused by invalid system path. DCOM tries to find two DLLs in the R_path. They are R.dll and rscproxy.dll. R.dll is located under R's folder when you install it, but you need install and load rscproxy package. Then you will find this dll file typically at C:\Program Files\R\R-2.9.0\library\rscproxy\libs. What you need to do is to add this path to your system path.

Sign in to comment.

Answers (2)

Cary Opel
Cary Opel on 17 Jun 2012
After using R(D)COM and Matlab R-link for a while, I do not recommend it. The COM interface has trouble parsing many commands and it is difficult to debug the code. I recommend using a system command from Matlab as described in the R Wiki. This also avoids having to install RAndFriends.

Shimin
Shimin on 31 Jul 2012
This problem is mostly caused by invalid system path. DCOM tries to find two DLLs in the R_path. They are R.dll and rscproxy.dll. R.dll is located under R's folder when you install it, but you need install and load rscproxy package. Then you will find this dll file typically at C:\Program Files\R\R-2.9.0\library\rscproxy\libs. What you need to do is to add this path to your system path.

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!