Re: [R] R.matlab package help

2010-08-28 Thread Ben Bolker
michael tufemichael at gmail.com writes:

 
 C:\Users\FAN'S~1\AppData\Local\Temp\tpe2b4012b_f9ed_402d_af0f_f21ebd8116a6.mat
 -V6 B

  I bet the problem is with the single quote (') in the path.

__
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.


Re: [R] R.matlab package help

2010-08-28 Thread Henrik Bengtsson
Hi.

On Fri, Aug 27, 2010 at 7:08 PM, michael tufemich...@gmail.com wrote:
 Henrik,
 The line before that is:

 Received cmd: 2
 save
 C:\Users\FAN'S~1\AppData\Local\Temp\tpe2b4012b_f9ed_402d_af0f_f21ebd8116a6.mat
 -V6 B

You should see have seen something like:

save(tmpname, '-V6', 'B');

For some reason Matlab is not picking up the patched version of MatlabServer.m.

Q1. Did you download that file and *replaced* the existing
MatlabServer.m with the downloaded one?

Q2. Did you shut down Matlab/the MatlabServer after replacing MatlabServer.m?

Q3. How do you start the MatlabServer?  Manually or via R?

If you don't manage to figure out how you replace MatlabServer.m, then
try to install the preliminary R.matlab v1.3.2:

source(http://www.braju.com/R/hbLite.R;);
installPackages(http://www.braju.com/R/patches/R.matlab/20100827/R.matlab_1.3.2.zip;);

and then restart R and the MatlabServer.

/Henrik

        [[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.


__
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.


Re: [R] R.matlab package help

2010-08-28 Thread michael
Henrik,

Yes I replaced the MatlabServer.m and restarted Matlab and R, it seems the
problem is still there. I see save(temp,-v6,B) there too. I use
MatlabServer.m mannually in Matlab, actually I couldn't use it in R, Matlab
will pop up a command window and never respond.


Thanks,

Michael

[[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.


Re: [R] R.matlab package help

2010-08-28 Thread Henrik Bengtsson
Michael,

could you please give me *verbatim* details on what messages you are
seeing.  In your previous reply you did *not* report seeing
save(tmpname, '-V6', 'B'); and now you say you get it.  Please do
not abbreviate what you are getting (e.g. save(temp,-v6,B)), because
that will not be useful and only confuse me more.  Can you please show
me exactly what you do and what you get in both Matlab and R,
otherwise there is no way I can help you solve this.  I also do not
know whether or not you installed that new version that I suggest. You
are the first one having this problem and it has to do with you having
an apostrophe in your Windows user name.

/Henrik

On Sat, Aug 28, 2010 at 2:22 PM, michael tufemich...@gmail.com wrote:
 Henrik,

 Yes I replaced the MatlabServer.m and restarted Matlab and R, it seems the
 problem is still there. I see save(temp,-v6,B) there too. I use
 MatlabServer.m mannually in Matlab, actually I couldn't use it in R, Matlab
 will pop up a command window and never respond.


 Thanks,

 Michael

        [[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.


__
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.


Re: [R] R.matlab package help

2010-08-28 Thread michael
Henrik,
   OK, finally I got the problem:  I have an  apostrophe in my
windowns 7 user name. That mess up the file name. So I logged in using a
guest account and it works:

Received cmd: 1
eval string: B
B =
   -0.1347
Sent byte: 0
Received cmd: 1
eval string: variables = {'B'};
Sent byte: 0
Received cmd: 2
save tempname-V6 B
answer=0

Thanks a lot for your patience and help.
One final question, the variable B I got from Matlab is not just a numeric
value, it is:

 B
$B
   [,1]
[1,] -0.1346952
attr(,header)
attr(,header)$description
[1] MATLAB 5.0 MAT-file, Platform: PCWIN, Created on: Sat Aug 28 18:40:26
2010  
attr(,header)$version
[1] 5
attr(,header)$endian
[1] little
How can I get only the numeric value, that ' -0.1346952' part?


Thanks again,

Michael
On Fri, Aug 27, 2010 at 7:59 AM, michael tufemich...@gmail.com wrote:

 Hi,all
  I have a problem running R.matlab package
 (under 2.10.1 version). I can set up the matlab server under local
 machine(run the MatlabServer.m), 


 And I can use setVariable and evaluate matlab functions in R. But when I
 ask
 Matlab to send the value back to R using getVariable function it
 always returns an error:
 
 ??? Error: A MATLAB string constant is not terminated properly.

 Error in == MatlabServer at 197
 eval(expr);
 

 it seems matlab have put the data into a temporary file, so my remote
 option is actually FALSE? (how to set it to be true?), or otherwise
 what could be the possible problem since I can send data to matlab
 from R but not vice versa.



  sessionInfo()
 R version 2.10.1 (2009-12-14)
 i386-pc-mingw32

 locale:
 [1] LC_COLLATE=English_United States.1252
 [2] LC_CTYPE=English_United States.1252
 [3] LC_MONETARY=English_United States.1252
 [4] LC_NUMERIC=C
 [5] LC_TIME=English_United States.1252

 attached base packages:
 [1] stats graphics  grDevices utils datasets  methods   base

 other attached packages:
 [1] R.utils_1.5.0 R.matlab_1.3.1R.oo_1.7.3R.methodsS3_1.2.0


  traceback()
 5: file(con, open = rb)
 4: readMat.default(filename)
 3: readMat(filename)
 2: getVariable.Matlab(matlab, B)
 1: getVariable(matlab, B)

 Thanks,

 Michael


[[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.


Re: [R] R.matlab package help

2010-08-28 Thread michael
OK, I think it is just B[1].

Thanks!

Michael

On Sat, Aug 28, 2010 at 6:50 PM, michael tufemich...@gmail.com wrote:

 Henrik,
OK, finally I got the problem:  I have an  apostrophe in my
 windowns 7 user name. That mess up the file name. So I logged in using a
 guest account and it works:


 Received cmd: 1
 eval string: B
 B =
-0.1347
 Sent byte: 0
 Received cmd: 1
 eval string: variables = {'B'};
 Sent byte: 0
 Received cmd: 2
 save tempname-V6 B
 answer=0

 Thanks a lot for your patience and help.
 One final question, the variable B I got from Matlab is not just a numeric
 value, it is:

  B
 $B
[,1]
 [1,] -0.1346952
 attr(,header)
 attr(,header)$description
 [1] MATLAB 5.0 MAT-file, Platform: PCWIN, Created on: Sat Aug 28 18:40:26
 2010  
 attr(,header)$version
 [1] 5
 attr(,header)$endian
 [1] little
 How can I get only the numeric value, that ' -0.1346952' part?


 Thanks again,

 Michael




[[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.


Re: [R] R.matlab package help

2010-08-28 Thread Henrik Bengtsson
Hi.

On Sat, Aug 28, 2010 at 3:50 PM, michael tufemich...@gmail.com wrote:
 Henrik,
           OK, finally I got the problem:  I have an  apostrophe in my
 windowns 7 user name. That mess up the file name. So I logged in using a
 guest account and it works:

 Received cmd: 1
 eval string: B
 B =
   -0.1347
 Sent byte: 0
 Received cmd: 1
 eval string: variables = {'B'};
 Sent byte: 0
 Received cmd: 2
 save tempname-V6 B
 answer=0

 Thanks a lot for your patience and help.

Good that you found a workaround.

 One final question, the variable B I got from Matlab is not just a numeric
 value, it is:

 B
 $B
           [,1]
 [1,] -0.1346952
 attr(,header)
 attr(,header)$description
 [1] MATLAB 5.0 MAT-file, Platform: PCWIN, Created on: Sat Aug 28 18:40:26
 2010                                                  
 attr(,header)$version
 [1] 5
 attr(,header)$endian
 [1] little
 How can I get only the numeric value, that ' -0.1346952' part?

The getVariable() function returns a named list where each element
contains the value of a particular Matlab object. You can request more
than one variable in each call. You need to use standard R list
operators to extract the element you'd like.  For example:

data - getVariable(matlab, c(B, A));
B - data$B;
A - data$A;

Thus, instead of writing:

B - getVariable(matlab, B);
B - B$B;

it is less confusing if you write:

data - getVariable(matlab, B);
B - data$B;

/Henrik



 Thanks again,

 Michael
 On Fri, Aug 27, 2010 at 7:59 AM, michael tufemich...@gmail.com wrote:

 Hi,all
                      I have a problem running R.matlab package
 (under 2.10.1 version). I can set up the matlab server under local
 machine(run the MatlabServer.m), 


 And I can use setVariable and evaluate matlab functions in R. But when I
 ask
 Matlab to send the value back to R using getVariable function it
 always returns an error:
 
 ??? Error: A MATLAB string constant is not terminated properly.

 Error in == MatlabServer at 197
     eval(expr);
 

 it seems matlab have put the data into a temporary file, so my remote
 option is actually FALSE? (how to set it to be true?), or otherwise
 what could be the possible problem since I can send data to matlab
 from R but not vice versa.



  sessionInfo()
 R version 2.10.1 (2009-12-14)
 i386-pc-mingw32

 locale:
 [1] LC_COLLATE=English_United States.1252
 [2] LC_CTYPE=English_United States.1252
 [3] LC_MONETARY=English_United States.1252
 [4] LC_NUMERIC=C
 [5] LC_TIME=English_United States.1252

 attached base packages:
 [1] stats     graphics  grDevices utils     datasets  methods   base

 other attached packages:
 [1] R.utils_1.5.0     R.matlab_1.3.1    R.oo_1.7.3        R.methodsS3_1.2.0


  traceback()
 5: file(con, open = rb)
 4: readMat.default(filename)
 3: readMat(filename)
 2: getVariable.Matlab(matlab, B)
 1: getVariable(matlab, B)

 Thanks,

 Michael


        [[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.


__
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.


Re: [R] R.matlab package help

2010-08-27 Thread michael
David,

 Thanks for your reply, I compile it under the old version of
R, I'll update R and run it again.

Michael

On Fri, Aug 27, 2010 at 7:59 AM, michael tufemich...@gmail.com wrote:
 Hi,all
                      I have a problem running R.matlab package
 (under 2.10.1 version). I can set up the matlab server under local
 machine(run the MatlabServer.m), 


 And I can use setVariable and evaluate matlab functions in R. But when I ask
 Matlab to send the value back to R using getVariable function it
 always returns an error:
 
 ??? Error: A MATLAB string constant is not terminated properly.

 Error in == MatlabServer at 197
     eval(expr);
 

 it seems matlab have put the data into a temporary file, so my remote
 option is actually FALSE? (how to set it to be true?), or otherwise
 what could be the possible problem since I can send data to matlab
 from R but not vice versa.



 sessionInfo()
 R version 2.10.1 (2009-12-14)
 i386-pc-mingw32

 locale:
 [1] LC_COLLATE=English_United States.1252
 [2] LC_CTYPE=English_United States.1252
 [3] LC_MONETARY=English_United States.1252
 [4] LC_NUMERIC=C
 [5] LC_TIME=English_United States.1252

 attached base packages:
 [1] stats     graphics  grDevices utils     datasets  methods   base

 other attached packages:
 [1] R.utils_1.5.0     R.matlab_1.3.1    R.oo_1.7.3        R.methodsS3_1.2.0


 traceback()
 5: file(con, open = rb)
 4: readMat.default(filename)
 3: readMat(filename)
 2: getVariable.Matlab(matlab, B)
 1: getVariable(matlab, B)

 Thanks,

 Michael


__
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.


Re: [R] R.matlab package help

2010-08-27 Thread michael
Henrik,
   Thanks for your reply. I am using Matlab version
7.9.0(R2009b). This is my first try using R.matlab. I started matlab
in the same machine, and I run the MatlabServer.m in matlab, here is
my code in R:

library(R.matlab)
library(MASS)
matlab - Matlab()
open(matlab)
setVerbose(matlab, -2)
setOption(matlab, readResult/interval, 10);
setOption(matlab, readResult/maxTries, 30*(60/10));

y-matrix(rnorm(100),100,1)
x-matrix(rnorm(200),100,1)
z-matrix(rnorm(200),100,2)

setVariable(matlab, y=y,remote=FALSE)
setVariable(matlab, x=x,remote=FALSE)
setVariable(matlab, z=z,remote=FALSE)
evaluate(matlab,B=TSLS(y,x,z);)
evaluate(matlab,B)
B - getVariable(matlab, B,remote=FALSE)


where TSLS is a matlab function that is already written and sitting in
the working folder. The code works fine until the last command,
getVariable function, where it returns an error:

??? Error: A MATLAB string constant is not terminated properly.

Error in == MatlabServer at 197
  eval(expr);

In R:
   Retrieving variables from the Matlab server: 'B'
   Sending expression on the Matlab server to be evaluated...:
'variables = {'B'};'
   Received an 'OK' reply (0) from the Matlab server.
   Evaluated expression on the Matlab server with return code 0.
   Asks the Matlab server to send variables via the local file system...
   Error in file(con, open = rb) : invalid 'description' argument


Thanks,

Michael

__
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.


Re: [R] R.matlab package help

2010-08-27 Thread Henrik Bengtsson
Hi,

what is the version of Matlab you are running?

Could you show a minimum verbatim example - starting with a fresh R
session and library(R.matlab) - that gives you the error?

Have you tried the example of help(Matlab)?  Then, for troubleshooting
it could be useful to ask Matlab to display values, e.g. eval(matlab,
A);  That will show you the value as in Matlab before being transfer
to R.

In that example, it is also suggested to do setVerbose(matlab, -2);
That'll give you more details on what is done under the hood.

To make sure I understand you correctly, you are trying to do this
where Matlab is started on the same machine, correct?

BTW, have you had any success running R.matlab before or is this your first try?

Cheers,

/Henrik

On Fri, Aug 27, 2010 at 6:58 AM, michael tufemich...@gmail.com wrote:
 I updated R and still have the problem.
 When I set
 remote = true, it reports:

 ??? Undefined variable java or class java.io.InputStreamByteWrapper.

 Error in == MatlabServer at 262
    reader = java.io.InputStreamByteWrapper(4096);

 and I changed remote = false, same problem pops up:

 ??? Error: A MATLAB string constant is not terminated properly.

 Error in == MatlabServer at 197
      eval(expr);


 Thanks,

 Michael

 On Fri, Aug 27, 2010 at 9:02 AM, michael tufemich...@gmail.com wrote:
 David,

         Thanks for your reply, I compile it under the old version of
 R, I'll update R and run it again.

 Michael

 On Fri, Aug 27, 2010 at 7:59 AM, michael tufemich...@gmail.com wrote:
 Hi,all
                      I have a problem running R.matlab package
 (under 2.10.1 version). I can set up the matlab server under local
 machine(run the MatlabServer.m), 


 And I can use setVariable and evaluate matlab functions in R. But when I ask
 Matlab to send the value back to R using getVariable function it
 always returns an error:
 
 ??? Error: A MATLAB string constant is not terminated properly.

 Error in == MatlabServer at 197
     eval(expr);
 

 it seems matlab have put the data into a temporary file, so my remote
 option is actually FALSE? (how to set it to be true?), or otherwise
 what could be the possible problem since I can send data to matlab
 from R but not vice versa.



 sessionInfo()
 R version 2.10.1 (2009-12-14)
 i386-pc-mingw32

 locale:
 [1] LC_COLLATE=English_United States.1252
 [2] LC_CTYPE=English_United States.1252
 [3] LC_MONETARY=English_United States.1252
 [4] LC_NUMERIC=C
 [5] LC_TIME=English_United States.1252

 attached base packages:
 [1] stats     graphics  grDevices utils     datasets  methods   base

 other attached packages:
 [1] R.utils_1.5.0     R.matlab_1.3.1    R.oo_1.7.3        R.methodsS3_1.2.0


 traceback()
 5: file(con, open = rb)
 4: readMat.default(filename)
 3: readMat(filename)
 2: getVariable.Matlab(matlab, B)
 1: getVariable(matlab, B)

 Thanks,

 Michael



 __
 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.


__
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.


Re: [R] R.matlab package help

2010-08-27 Thread Henrik Bengtsson
Hi,

could you send me what Matlab is outputting.  When I send the following from R:

 evaluate(matlab, A=2;);
Sending expression on the Matlab server to be evaluated...: 'A=2;'

and Matlab should print something like:

Received cmd: 1
eval string: A=2;
Received an 'OK' reply (0) from the Matlab server.
Evaluated expression on the Matlab server with return code 0.
Sent byte: 0

I'm really interested to see what that eval string line looks like
just before you get the error.

/Henrik

On Fri, Aug 27, 2010 at 9:38 AM, michael tufemich...@gmail.com wrote:
 Henrik,
           Thanks for your reply. I am using Matlab version
 7.9.0(R2009b). This is my first try using R.matlab. I started matlab
 in the same machine, and I run the MatlabServer.m in matlab, here is
 my code in R:

 library(R.matlab)
 library(MASS)
 matlab - Matlab()
 open(matlab)
 setVerbose(matlab, -2)
 setOption(matlab, readResult/interval, 10);
 setOption(matlab, readResult/maxTries, 30*(60/10));

 y-matrix(rnorm(100),100,1)
 x-matrix(rnorm(200),100,1)
 z-matrix(rnorm(200),100,2)

 setVariable(matlab, y=y,remote=FALSE)
 setVariable(matlab, x=x,remote=FALSE)
 setVariable(matlab, z=z,remote=FALSE)
 evaluate(matlab,B=TSLS(y,x,z);)
 evaluate(matlab,B)
 B - getVariable(matlab, B,remote=FALSE)


 where TSLS is a matlab function that is already written and sitting in
 the working folder. The code works fine until the last command,
 getVariable function, where it returns an error:

 ??? Error: A MATLAB string constant is not terminated properly.

 Error in == MatlabServer at 197
      eval(expr);

 In R:
   Retrieving variables from the Matlab server: 'B'
   Sending expression on the Matlab server to be evaluated...:
 'variables = {'B'};'
   Received an 'OK' reply (0) from the Matlab server.
   Evaluated expression on the Matlab server with return code 0.
   Asks the Matlab server to send variables via the local file system...
   Error in file(con, open = rb) : invalid 'description' argument


 Thanks,

 Michael

 __
 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.


__
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.


Re: [R] R.matlab package help

2010-08-27 Thread michael
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 )...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@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.


Re: [R] R.matlab package help

2010-08-27 Thread Henrik Bengtsson
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 tufemich...@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 )...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@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.


__
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.


Re: [R] R.matlab package help

2010-08-27 Thread michael
Henrik,
  I updated the MatlabServer.m from the link you sent to me, but it
still doen't work. I have the same problems as before, when remote=FALSE,
getVariable doesn't work; when remote=TRUE, setVariable says:

Received cmd: 5
Will read MAT file structure of length: 984 bytes.
??? Undefined variable java or class java.io.InputStreamByteWrapper.
Error in == MatlabServer at 262
reader = java.io.InputStreamByteWrapper(4096);

Thanks,

Michael

[[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.


Re: [R] R.matlab package help

2010-08-27 Thread Henrik Bengtsson
Hi,

let's stick with the remote=FALSE case first.  What output does Matlab
produce now?  That is really key information in order to solve this.
Also, make sure that you really restart the MatlabServer.

/H

On Fri, Aug 27, 2010 at 3:56 PM, michael tufemich...@gmail.com wrote:
 Henrik,
          I updated the MatlabServer.m from the link you sent to me, but it
 still doen't work. I have the same problems as before, when remote=FALSE,
 getVariable doesn't work; when remote=TRUE, setVariable says:

 Received cmd: 5
 Will read MAT file structure of length: 984 bytes.
 ??? Undefined variable java or class java.io.InputStreamByteWrapper.
 Error in == MatlabServer at 262
    reader = java.io.InputStreamByteWrapper(4096);

 Thanks,

 Michael

        [[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.


__
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.


Re: [R] R.matlab package help

2010-08-27 Thread michael
Henrik,
  When I set remote=FALSE, I got this error:

??? Error: A MATLAB string constant is not terminated properly.
Error in == MatlabServer at 197
  eval(expr);

In R:

   Retrieving variables from the Matlab server: 'B'
   Sending expression on the Matlab server to be evaluated...: 'variables =
{'B'};'
   Received an 'OK' reply (0) from the Matlab server.
   Evaluated expression on the Matlab server with return code 0.
   Asks the Matlab server to send variables via the local file system...
   Error in file(con, open = rb) : invalid 'description' argument
Thanks,

Michael

[[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.


Re: [R] R.matlab package help

2010-08-27 Thread Henrik Bengtsson
On Fri, Aug 27, 2010 at 6:16 PM, michael tufemich...@gmail.com wrote:
 Henrik,
          When I set remote=FALSE, I got this error:

 ??? Error: A MATLAB string constant is not terminated properly.
 Error in == MatlabServer at 197
      eval(expr);

Also the lines before.

/Henrik


 In R:

   Retrieving variables from the Matlab server: 'B'
   Sending expression on the Matlab server to be evaluated...: 'variables =
 {'B'};'
   Received an 'OK' reply (0) from the Matlab server.
   Evaluated expression on the Matlab server with return code 0.
   Asks the Matlab server to send variables via the local file system...
   Error in file(con, open = rb) : invalid 'description' argument
 Thanks,

 Michael

        [[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.


__
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.


Re: [R] R.matlab package help

2010-08-27 Thread michael
Henrik,
 The line before that is:

Received cmd: 2
save
C:\Users\FAN'S~1\AppData\Local\Temp\tpe2b4012b_f9ed_402d_af0f_f21ebd8116a6.mat
-V6 B
Thanks,

Michael

[[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.