Dear useRs, This post relates to a similar problem ( https://stat.ethz.ch/pipermail/r-help/2010-August/250719.html)
I am using R.matlab (R.matlab v1.6.3 (2013-01-17) to iterate matrix multiplication in matlab 2012Rb. Everything works fine except for some random iteration of my model the command getVariable would fail to bring matlab objects back to R. Could someone help me understand what's going on behind the scenes ? Here is the command lines I use th launch the matlab server library(R.matlab) Matlab$startServer() Sys.sleep(10) matlab <- Matlab(host="localhost") if (!open(matlab)) throw("Matlab server is not running: waited 30 seconds.") setVerbose(matlab, -2) Here is the eval expression used followed by the error displayed in the matlab command window. Received cmd: 3 Will read MAT file: "C:\Users\tvb\AppData\Local\Temp\RtmpqqP3O8\file129c25a537b7.mat" Received cmd: 1 "eval" string: " Tr = TrA(INF,:).* IHo; Susc = SHo * Sc; myKS = ones(N,1); myKS(find(moveBan > 0),1) = KernelShrinkage; myKS = gpuArray(myKS); dMG = gpuArray(dM(:,INF)); K1G = exp(-kparShort*(dMG)); K1G = bsxfun(@times, myKS,K1G); K2G = exp(-kparLong*(dMG)); K2G = bsxfun(@times, myKS,K2G); FoIG=Susc.*((K1G*(Tr(:,1)+Tr(:,2)+Tr(:,3))) + (K2G*Tr(:,4))); ProbI = 1-exp(-FoIG); res = gather(ProbI); " Sent byte: 0 Received cmd: 1 "eval" string: "variables = {'res'};" Sent byte: 0 Received cmd: 2 save(tmpname, '', 'res') answer=0 Error using MatlabServer (line 147) Java exception occurred: java.net.SocketException: Connection reset at java.net.SocketInputStream.read(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at java.io.DataInputStream.readByte(Unknown Source) -- -------------------------------------------------- Thomas Van Boeckel FNRS Research Fellow Lutte biologique et Ecologie spatiale (LUBIES) Universite Libre de Bruxelles CP 160/12 50, av F.D. Roosevelt 1050, Bruxelles BELGIUM <http://www.ulb.ac.be/sciences/lubies/mgilbert.html> Tel: +32-2-650.37.81 --------------------------------------------------- [[alternative HTML version deleted]] ______________________________________________ R-help@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.