[R] R.matlab package help
Henrik Bengtsson
hb at stat.berkeley.edu
Sat Aug 28 00:15:21 CEST 2010
Hi,
the reason for your problem is that there is a single quotation mark
in the temporary pathname generated by Matlab which confuses Matlab
when trying to save the file. Try replacing the existing
MatlabServer.m file (should be in the directory where Matlab is
running), with this file:
http://www.braju.com/R/patches/R.matlab/20100827/MatlabServer.m
Let me know if it works. If so, I'll submit a new version of R.matlab
to CRAN with the fix.
/Henrik
On Fri, Aug 27, 2010 at 12:27 PM, michael <tufemichael at gmail.com> wrote:
> Henrik,
> Here is the matlab response:
>
>>> MatlabServer
> 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)...done.
>
> so I connect to matlab using
> open(matlab)
> in R:
>
> Connected to client.
>
> then I send the variable to matlab:
> setVariable(matlab, y=y,remote=FALSE)
> Received cmd: 3
> Will read MAT file:
> "C:\Users\FAN'S~1\AppData\Local\Temp\Rtmpl04K6T\file2fff3c61.mat"
> setVariable(matlab, x=x,remote=FALSE)
> Received cmd: 3
> Will read MAT file:
> "C:\Users\FAN'S~1\AppData\Local\Temp\Rtmpl04K6T\file288f6c69.mat"
> setVariable(matlab, z=z,remote=FALSE)
> Received cmd: 3
> Will read MAT file:
> "C:\Users\FAN'S~1\AppData\Local\Temp\Rtmpl04K6T\file22cd3a61.mat"
>
> evaluate(matlab,"B=TSLS(y,x,z);")
> Received cmd: 1
> "eval" string: "B=TSLS(y,x,z);"
> Sent byte: 0
> evaluate(matlab,"B")
> Received cmd: 1
> "eval" string: "B"
> B =
> -0.7548
> Sent byte: 0
> B <- getVariable(matlab, "B",remote=FALSE)
> Received cmd: 2
> save
> C:\Users\FAN'SH~1\AppData\Local\Temp\tp4f05d961_4460_47ba_a064_cfd418a19d60.mat
> -V6 B
> ??? Error: A MATLAB string constant is not terminated properly.
> Error in ==> MatlabServer at 197
> eval(expr);
>
>
> Thanks,
>
> Michael
>
> [[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.
>
More information about the R-help
mailing list