MatlabConnector

class MatlabConnector

This class is used only from inside of the MATLAB JVM. It is responsible for creating instances of JMIWrapperRemote and sending them to a waiting receiver over RMI. While this class is package private, it can be seen by MATLAB, which does not respect the package privateness of the class. The public methods in this class can be accessed from inside the MATLAB environment.

Author:Joshua Kaplan

Methods

connect

static void connect(String receiverID, int port, boolean existingSession)

Retrieves the receiver and sends over the JMIWrapperRemote on a separate thread so that MATLAB can continue to initialize.

Parameters:
  • receiverID
  • port
  • existingSession

connectFromMatlab

public static void connectFromMatlab(String receiverID, int port)

Called from MATLAB at launch. Creates the JMI wrapper and then sends it over RMI to the Java program running in a separate JVM.

Parameters:
  • receiverID – the key that binds the receiver in the registry
  • port – the port the registry is running on
  • initializationTime

isAvailableForConnection

static boolean isAvailableForConnection()

If this session of MATLAB is available to be connected to from an external Java program. It will be available if it is not currently connected to and there is no connection in progress.