4

After we open a MATLAB IDE, are we still able to write to its command window from another process?

In Windows, we could use MATLAB Engine API to attach to an existing MATLAB, while this does not work in Linux/Mac.

Do we have any solutions in Linux?

Joe C
  • 2,757
  • 2
  • 26
  • 46
  • Where does it state that the MATLAB Engine API can't work on Linux or Mac? – Suever Apr 13 '16 at 13:03
  • @Suever It works on Linux/Mac. But attach/changing visibility does not work: http://www.mathworks.com/help/matlab/matlab_external/attaching-to-an-existing-matlab-session.html and http://www.mathworks.com/help/matlab/apiref/engsetvisible.html. – Joe C Apr 13 '16 at 14:31

1 Answers1

2

If you want to connect from a separate java process, consider using MatlabControl. It allows you to easily launch new Matlab instance from java process and then communicate with it though JMI, i.e. java-to-matlab interface that is shipped with each Matlab release.

Is it also possible to connect to existing Matlab instance, but you will need to modify MatlabControl code to do that, and you will need to manually execute some command from within the Matlab instance you wish to connect to.

There is a nice series of articles on MatlabControl / JMI on Undocumented Matlab.

As of 2016b, there is also an official MATLAB Engine API for Java.

nirvana-msu
  • 3,877
  • 2
  • 19
  • 28