I'm using the matlabcontrol package in Java to connect to Matlab r2015a and start a selected script. This is all working great, but every time I run the script, Matlab opens a command window with the output. This output is already returned in Eclipse, so it's redundant.
I'm creating a session with Matlab the following way:
public interface IMatLab {
MatlabProxyFactoryOptions options = new MatlabProxyFactoryOptions.Builder()
.setUsePreviouslyControlledSession(true).setHidden(true)
.setMatlabLocation(null).build();
MatlabProxyFactory factory = new MatlabProxyFactory(options);
public static String runScript(String pathFunc, int param1, int param2)
throws MatlabConnectionException, MatlabInvocationException {
MatlabProxy proxy = factory.getProxy();
// locating MatLab files
proxy.setVariable("path", pathFunction);
proxy.eval("addpath(path)");
// calling add function in MatLab code
Object[] obj = proxy.returningFeval("add", 1, param1, param2);
String outputScript = toString(obj[0]);
return outputScript;
}
Is there any way to hide the command window when calling Matlab? With the 'setHidden' to false, it starts the full Matlab session, instead of just the command window.
I prefer to do this in java itself. If that's not an option, changing config in Matlab is also fine.