Download matlabcontrol-4.1.0.jar library from https://code.google.com/p/matlabcontrol/
then try below code
then try below code
import matlabcontrol.*;
import matlabcontrol.MatlabProxyFactory;
import matlabcontrol.MatlabProxyFactoryOptions;
/**
*
* @author RajBharath
*/
public class MatlabCommunication{
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws Exception
{
// create proxy
MatlabProxyFactoryOptions options = new MatlabProxyFactoryOptions.Builder()
.setUsePreviouslyControlledSession(true)
.build();
MatlabProxyFactory factory = new MatlabProxyFactory(options);
MatlabProxy proxy = factory.getProxy();
proxy.eval("disp('hello world')");
// call user-defined function (must be on the path)
// close connection
proxy.disconnect();
}
}
No comments:
Post a Comment