The COM interface has trouble parsing many commands and it isĭifficult to debug the code. Please let me know if anything here becomes obsolete.Īfter using R(D)COM and Matlab R-link for a while, I do not recommend This is basically an updated version of Kevin Murphy's site. The site where you downloaded R-Matlab has some useful Q&A so you might inquire there. If that doesn't help, I probably won't be able to help, but go ahead and ask as someone might know. If the above doesn't work, go to C:\Program Files\R, open the (D)COM Server folder, go to 'bin', copy 'sciproxy.dll', and paste it in C:\Program Files\MATLAB\R2009a\bin (obviously you may have a different path to Matlab's binary folder). To close the connection to R, and the graphs opened from R, enter: PutRdata('x',x) %put data into R workspace This should evoke:įor instance, enter the following in Matlab: A couple things to watch out for: Python is zero-indexed whereas Matlab is one-indexed. To see if the toolbox is working, start Matlab and enter 'Rdemo' at the command prompt. Is there a generic way to convert a MATLAB code into an R-code Thanks. Converting certain trivial pieces of Matlab code to Python can be as simple as ditching semicolons and using square brackets in space of parentheses (). Be sure to add MATLAB_RLINK to your Matlab path. Get MATLAB_RLINK.zip here, unzip the contents, and paste MATLAB_RLINK in Matlab's toolbox folder (or whatever folder you want). Note this server is built for Scilab, which is an open source version of Matlab, but it seems to work for Matlab too. I installed it using the default settings without checking or unchecking any boxes.
Of course, this doesn't mean I don't have to learn how to use R, it just means I get to do it all in Matlab (and note for fellow Matlab users, there is a great cheat sheet that shows how to translate between the two).ĭownload it here. It assumes you already have R and Matlab properly installed on your computer. I have only done the following in Windows XP, and I used Matlab version 7.8. Since I just set it up in my Matlab environment, I thought I'd write out the recipe I followed. Luckily, it is pretty easy to run R code from Matlab. R (site here) is a great open-source environment for statistical analysis.