This is very odd, but maybe 'cd' is not a command on your Windows Matlab installation. I tried the same code on a Unix installation (I don't have access to Matlab for Windows but others have been using R.matlab there successfully). Find out what the command for getting the current directory in your Matlab version is and use that instead.
You could also troubleshoot by this: 1. Start Matlab using Matlab$startServer(minimize=FALSE) 2. Setup the Matlab connection from R and close it with close(matlab). 3. Go to the Matlab windows and try the commands that failed for you when called from R. This will give you a hint. Remember, there is nothing magic going on. Think about the R Matlab connection as R is typing the Matlab commands for you; anything you can do in that Matlab windows which you did close(matlab) on you can do with evaluate(matlab, ...) - before closing it that is. /Henrik On 12/30/06, Bhanu Kalyan.K <[EMAIL PROTECTED]> wrote: > Dear Mr. Bengtsson, > > I worked on the code you sent. But, I dont think it is responding either. > Kindly verify. > > > evaluate(matlab, "pwd=cd();"); > > Sending expression on the Matlab server to be evaluated...: 'pwd=cd();' > Received an 'MatlabException' reply (-1) from the Matlab server: 'Error: > Expected a variable, function, or constant, found ")".' > Error in list("evaluate(matlab, "pwd=cd();")" = <environment>, > "evaluate.Matlab(matlab, "pwd=cd();")" = <environment>, : > > [2006-12-30 15:08:34] Exception: MatlabException: Error: Expected a > variable, function, or constant, found ")". > at throw(Exception(...)) > at throw.default("MatlabException: ", lasterr) > at throw("MatlabException: ", lasterr) > at readResult.Matlab(this) > at readResult(this) > at evaluate.Matlab(matlab, "pwd=cd();") > at evaluate(matlab, "pwd=cd();") > > > pwd <- getVariable(matlab, "pwd")$pwd; > > Retrieving variables from the Matlab server: 'pwd' > Sending expression on the Matlab server to be evaluated...: 'variables = > {'pwd'};' > 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 readChar(con = con, nchars = nbrOfBytes) : > invalid value for 'nchar' > > > print(pwd); > > Error in print(pwd) : object "pwd" not found > > > evaluate(matlab, "files=dir();") > > Sending expression on the Matlab server to be evaluated...: 'files=dir();' > Error in readChar(con = con, nchars = nbrOfBytes) : > invalid value for 'nchar' > > Kindly verify and let me know the solution. > > Regards, > Bhanu Kalyan K > > > > Bhanu Kalyan K > BTech CSE Final Year > [EMAIL PROTECTED] > Tel :+91-9885238228 > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com ______________________________________________ R-help@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.