JMIWrapper¶
-
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 sendeval
andfeval
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 ofjmi.jar
that is distributed with your copy of MATLAB. It is located atmatlabroot/java/jar/jmi.jar
wherematlabroot
is the location of your MATLAB installation. The location ofmatlabroot
can be determined by executing thematlabroot
command in the MATLAB Command Window. This is the only class in matlabcontrol which directly links against code injmi.jar
. (And therefore also the only class that needsjmi.jar
to be on the classpath in order to compile.)Configuration
also uses code injmi.jar
but uses reflection to interact with it.Author: Joshua Kaplan
Methods¶
exit¶
-
static void
exit
()¶ Exits MATLAB without waiting for MATLAB to return, because MATLAB will not return when exiting.
Throws:
invokeAndWait¶
-
static <T> T
invokeAndWait
(MatlabThreadCallable<T> callable)¶ Invokes the
callable
on the main MATLAB thread and waits for the computation to be completed.Parameters: - <T> –
- callable –
Throws: