Writing Java code in Matlab?
- by scooziexp
Hi,
I'm trying to use the Java commands pw.println() and br.readLine() in Matlab because I have set up a socket (input_socket2) between Matlab and a command-line program I want to control using Java classes BufferedReader and PrintWriter. Before the following snippet of code, I implemented another socket that goes between 2 computers. This works great and I also know that the following snippet of code successfully opens up a communication line between Matlab and the other program. However, Matlab throws an error at pw.println('noop'). I think it has something to do with syntax, but I'm not sure how to write the command in Matlab syntax then:
try
input_socket2 = Socket(host2,port2);
input_stream2 = input_socket2.getInputStream;
d_input_stream2 = DataInputStream(input_stream2);
br = BufferedReader(InputStreamReader(input_stream2));
pw = PrintWriter(input_socket2.getOutputStream,true);
pw.println('noop')
br.read
end
Any ideas?