[R] Query regarding linking R with Matlab
Henrik Bengtsson
henrikb at braju.com
Sun Dec 17 23:15:41 CET 2006
Hi,
what operating system are you on and what version of Matlab do you have?
In general you should be able to get started with R.matlab by first
installing all required packages from CRAN:
install.packages(c("R.oo", "R.utils", "R.matlab"))
Then load the package:
library(R.matlab)
>From there just follow the example in help(Matlab):
# Create a Matlab client
matlab <- Matlab(host="localhost", port=9998)
# Connect to the Matlab server
if (!open(matlab))
throw("Matlab server is not running: waited 30 seconds.")
# Run Matlab expressions on the Matlab server
res <- evaluate(matlab, "A=1+2;", "B=ones(2,20);")
# Get Matlab variables
data <- getVariable(matlab, c("A", "B"))
cat("Received variables:\n")
str(data)
...
# When done, close the Matlab client, which will also shutdown
# the Matlab server and the connection to it.
close(matlab)
Hope this helps
Henrik
On 12/15/06, Bhanu Kalyan.K <kalyansikha at yahoo.com> wrote:
> Thank you sir for your prompt reply.
> Currently i am stuck at point where I need to call an available Matlab
> program from an R 2.4.0 interface. How can I do this? I have downloaded the
> R.matlab file and also the manual in pdf. But still i am not able to get
> through the problem. I will be grateful to you if you can elaborate me on
> this.
>
> Awaiting your reply,
>
> regards,
> Bhanu Kalyan K
>
>
> Bhanu Kalyan K
> BTech CSE Final Year
> reach4kalyan at gmail.com
> Tel :+91-9885238228
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
More information about the R-help
mailing list