Rank: 85456 based on 0 downloads (last 30 days) and 0 file submitted



Personal Profile:


Watch this Author's files


Comments and Ratings by Marc
Updated File Comments Rating
05 Dec 2012 MATLAB R-link Functions for calling the statistical package R from within MATLAB. Author: Robert Henson

So, I'm just beginning to use this and running into some trouble. The install worked fine but I am having issues using the evalR() function to source a function I have saved to disk. First, I attempted to write the code:

[RESULT, STATUS, MSG] = evalR('source('~/R functions/makerm function.R')');

however this provides an error in matlab itself because the portion of the code between the apostrophes of the evalR(‘ ‘) statement does not permit the entire command to be sent to R, specifically the 'source('~/R functions/makerm function.R')' portion of the command is what I want to execute in R. So, I tried the typical matlab method of adding an extra apostrophe within the text to make apostrophes actually read as apostrophes rather than as indicators of groupings within the command. I used the code:

[RESULT, STATUS, MSG] = evalR('source(''~/R functions/makerm function.R'')');

this runs however in the MSG output variable it says

"Error using COM.StatConnectorSrv_StatConnector/Evaluate Invoke Error, Dispatch Exception: There is no connection for this connection ID".

I am not sure as to what connection the error is talking about but I know that the DCOM connection is working since the Rdemo.m runs fine and I am able to send and compute things in my own scripts.

Ultimately, I'm trying to get R functions that I have created and saved on my hard drive to be accessible and used when I send data from Matlab to R. Thanks for any help you can give me regarding how to source a function via the matlab R link interface.

Contact us