[R] R.matlab errors and slow con

From: Christina Curtis <christina.curtis_at_gmail.com>
Date: Mon, 17 Mar 2008 18:25:47 +0000


I have noticed that when using R.matlab that the connection can become quite slow though it remains open.
I have to kill both my R session and Matlab to start over and establish a new connection (eg. close(matlab) - seems hung). Is there a way around this?

I have been doing the following to establish the connection :

Matlab(host="localhost", port=9999, remote=FALSE) matlab<- Matlab()

Also, the initial examples in the help file work fine, but I encounter an error when trying to evaluate the following expression: # Create a function (M-file) on the Matlab server setFunction(matlab, " \
function [win,aver]=dice(B) \
%Play the dice game B times \
gains=[-1,2,-3,4,-5,6]; \
plays=unidrnd(6,B,1); \
win=sum(gains(plays)); \
aver=win/B; \

> evaluate(matlab, "[w,a]=dice(1000);")
Error in list("evaluate(matlab, "[w,a]=dice(1000);")" = <environment>, :

[2008-03-17 17:56:04] Exception: MatlabException: Undefined function or method '
unidrnd' for input arguments of type 'double'.   at throw(Exception(...))
  at throw.default("MatlabException: ", lasterr)   at throw("MatlabException: ", lasterr)   at readResult.Matlab(this)
  at readResult(this)
  at evaluate.Matlab(matlab, "[w,a]=dice(1000);")   at evaluate(matlab, "[w,a]=dice(1000);")

Also, can one use this package to call objects generated in Matlab using various toolboxes?

> sessionInfo()

R version 2.6.2 (2008-02-08)
attached base packages:
[1] stats graphics grDevices utils datasets methods base other attached packages:
[1] R.utils_1.0.1 R.matlab_1.1.4 R.oo_1.4.2 R.methodsS3_1.0.1 loaded via a namespace (and not attached): [1] rcompgen_0.1-17


        [[alternative HTML version deleted]]

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 17 Mar 2008 - 18:30:16 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 17 Mar 2008 - 19:30:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive