.. java:import:: java.awt EventQueue .. java:import:: java.util.concurrent ArrayBlockingQueue .. java:import:: com.mathworks.jmi Matlab .. java:import:: com.mathworks.jmi NativeMatlab .. java:import:: matlabcontrol MatlabProxy.MatlabThreadCallable .. java:import:: matlabcontrol MatlabProxy.MatlabThreadProxy JMIWrapper ========== .. java:package:: matlabcontrol :noindex: .. java:type:: class JMIWrapper Interacts with MATLAB via the undocumented Java MATLAB Interface (JMI). This code is inspired by \ `Kamin Whitehouse `_\ 's \ `MatlabControl `_\ . Fixes to concurrency bugs in this class have been aided by the feedback of several matlabcontrol users, thank you for your feedback! This class runs inside of MATLAB's Java Virtual Machine and relies upon the Java MATLAB Interface which is distributed by MathWorks as \ ``jmi.jar``\ . It allows for Java to send \ ``eval``\ and \ ``feval``\ statements to MATLAB and receive results. \ ``jmi.jar``\ is \ **not**\ distributed with matlabcontrol as it is the property of MathWorks. If you wish to compile the source code you will need to reference the version of \ ``jmi.jar``\ that is distributed with your copy of MATLAB. It is located at \ ``matlabroot/java/jar/jmi.jar``\ where \ ``matlabroot``\ is the location of your MATLAB installation. The location of \ ``matlabroot``\ can be determined by executing the \ ``matlabroot``\ command in the MATLAB Command Window. This is the only class in matlabcontrol which directly links against code in \ ``jmi.jar``\ . (And therefore also the only class that needs \ ``jmi.jar``\ to be on the classpath in order to compile.) \ :java:ref:`Configuration`\ also uses code in \ ``jmi.jar``\ but uses reflection to interact with it. :author: \ `Joshua Kaplan `_\ Methods ------- eval ^^^^ .. java:method:: static void eval(String command) throws MatlabInvocationException :outertype: JMIWrapper exit ^^^^ .. java:method:: static void exit() :outertype: JMIWrapper Exits MATLAB without waiting for MATLAB to return, because MATLAB will not return when exiting. :throws MatlabInvocationException: feval ^^^^^ .. java:method:: static void feval(String functionName, Object... args) throws MatlabInvocationException :outertype: JMIWrapper getVariable ^^^^^^^^^^^ .. java:method:: static Object getVariable(String variableName) throws MatlabInvocationException :outertype: JMIWrapper invokeAndWait ^^^^^^^^^^^^^ .. java:method:: static T invokeAndWait(MatlabThreadCallable callable) throws MatlabInvocationException :outertype: JMIWrapper Invokes the \ ``callable``\ on the main MATLAB thread and waits for the computation to be completed. :param : :param callable: :throws MatlabInvocationException: returningEval ^^^^^^^^^^^^^ .. java:method:: static Object[] returningEval(String command, int nargout) throws MatlabInvocationException :outertype: JMIWrapper returningFeval ^^^^^^^^^^^^^^ .. java:method:: static Object[] returningFeval(String functionName, int nargout, Object... args) throws MatlabInvocationException :outertype: JMIWrapper setVariable ^^^^^^^^^^^ .. java:method:: static void setVariable(String variableName, Object value) throws MatlabInvocationException :outertype: JMIWrapper