In order to start matlab server in R , I using the following commands
getwd()
setwd("D:\R_matlab")
install.packages("R.oo")
install.packages("R.matlab")
install.packages("R.utils")
library(R.matlab)
Matlab$startServer()
a minimized MATLAB Command Window come out,
but I can't make this window become larger. Does anyone know why?
I type "Matlab$startServer()" again, I get another MATLAB Command Window
and I can maximize this window, From this window: I see such message:
To get started, type one of these: helpwin, helpdesk, or demo.
For product information, visit www.mathworks.com.
Matlab v7.x or higher detected.
Saving with option -V6.
Added InputStreamByteWrapper to dynamic Java CLASSPATH.
----------------------
Matlab server started!
----------------------
Trying to open server socket (port 9999)...??? Java exception occurred:
java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(Unknown Source)
at java.net.ServerSocket.bind(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
.
Error in ==> MatlabServer at 113
server = ServerSocket(port);
?
Does anyone would like to point out what is reason for these?
I am new to R.matlab. I am not sure if this question is too silly. Before I
post this
question here, I did try to do google search to find answer by myself.
But I didn't get point.
If this question bother you too much, I am really sorry for this.
Thanks,
Aimin Yan
Start Matlab server in R 2.4.0
2 messages · Aimin Yan, Henrik Bengtsson
Hi.
On 12/18/06, Aimin Yan <aiminy at iastate.edu> wrote:
In order to start matlab server in R , I using the following commands
getwd()
setwd("D:\R_matlab")
install.packages("R.oo")
install.packages("R.matlab")
install.packages("R.utils")
library(R.matlab)
Matlab$startServer()
a minimized MATLAB Command Window come out,
but I can't make this window become larger. Does anyone know why?
You can change this, by calling Matlab$startServer(minimize=FALSE) On Windows, Matlab is started minimized by default, because the information in that window is of no interest (except for debugging) and you cannot type anything in that window anyway. However, read further...
I type "Matlab$startServer()" again, I get another MATLAB Command Window
and I can maximize this window, From this window: I see such message:
To get started, type one of these: helpwin, helpdesk, or demo.
For product information, visit www.mathworks.com.
Matlab v7.x or higher detected.
Saving with option -V6.
Added InputStreamByteWrapper to dynamic Java CLASSPATH.
----------------------
Matlab server started!
----------------------
Trying to open server socket (port 9999)...??? Java exception occurred:
java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(Unknown Source)
at java.net.ServerSocket.bind(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
.
Error in ==> MatlabServer at 113
server = ServerSocket(port);
?
Does anyone would like to point out what is reason for these?
The reason for this is that you already started one Matlab session using (default) port 9999. When you start the second one, the error message (from Java) says that that port is already taken. So this is expected. However, I am not sure why you can't maximize the first, but the second. Odd. However, ...
I am new to R.matlab. I am not sure if this question is too silly. Before I post this question here, I did try to do google search to find answer by myself. But I didn't get point. If this question bother you too much, I am really sorry for this.
You do not have to start the Matlab server explicitly like this;
instead setup a Matlab object in R as illustrated in the
help(R.matlab) example and the server will be started when you call
open() on that object, e.g.
matlab <- Matlab(host="localhost", port=9998)
if (!open(matlab))
throw("Matlab server is not running: waited 30 seconds.")
# If you get here, you have a working R-Matlab connection
BCD <- matrix(rnorm(10000), ncol=100)
setVariable(matlab, ABCD=ABCD) # Send to Matlab
data <- getVariable(matlab, "ABCD") # Receive from Matlab
str(data)
The open() call will call Matlab$startServer() for you, and on Windows
it will be minimized, so in that sense there is no change. But again,
there is not much for you to see there.
Hope this helps
Henrik
Thanks, Aimin Yan
______________________________________________ R-help at stat.math.ethz.ch 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.