gui.jmatlink
Class CoreJMatLink

java.lang.Object
  extended by java.lang.Thread
      extended by gui.jmatlink.CoreJMatLink
All Implemented Interfaces:
java.lang.Runnable

public class CoreJMatLink
extends java.lang.Thread


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
CoreJMatLink()
          This is the constructor for the CoreJMatLink library.
 
Method Summary
 void destroy()
          terminate running thread
 void engClose()
          Close the connection to MATLAB.
 void engClose(long epL)
          Close a specified connection to an instance of MATLAB.
 void engCloseAll()
          Close all open handles to MATLAB.
 void engEvalString(long epL, java.lang.String evalS)
          Evaluate an expression in MATLAB's workspace.
 void engEvalString(java.lang.String evalS)
          Evaluate an expression in MATLAB's workspace.
 double[][] engGetArray(long epL, java.lang.String arrayS)
          Get an array from a specified instance/workspace of MATLAB.
 double[][] engGetArray(java.lang.String arrayS)
          Get an array from MATLAB's workspace.
 java.lang.String[] engGetCharArray(java.lang.String arrayS)
          Get an 'char' array (string) from MATLAB's workspace.
 double engGetScalar(long epL, java.lang.String arrayS)
          Get a scalar value from a specified workspace.
 double engGetScalar(java.lang.String arrayS)
          Get a scalar value from MATLAB's workspace.
 boolean engGetVisible(long epL)
           
 void engOpen(java.lang.String startCmdS)
          Open engine.
 long engOpenSingleUse(java.lang.String startCmdS)
          Open engine for single use.
 java.lang.String engOutputBuffer()
          Return the outputs of previous commands from MATLAB's workspace.
 java.lang.String engOutputBuffer(long epL, int buflenI)
          Return the ouputs of previous commands in MATLAB's workspace.
 void engPutArray(long epL, java.lang.String arrayS, double[][] valuesDD)
          Put an array (2 dimensional) into a specified instance/workspace of MATLAB.
 void engPutArray(java.lang.String arrayS, double[][] valuesDD)
          Put an array (2 dimensional) into MATLAB's workspace.
 void engSetVisible(long epL, boolean engVisB)
           
 void kill()
           
 void run()
           
 void setDebug(boolean debugB)
          Switch on or disable debug information printed to standard output.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CoreJMatLink

public CoreJMatLink()
This is the constructor for the CoreJMatLink library.

Method Detail

destroy

public void destroy()
terminate running thread

Overrides:
destroy in class java.lang.Thread

kill

public void kill()

engOpen

public void engOpen(java.lang.String startCmdS)
Open engine. This command is used to open a single connection to MATLAB.

This command is only useful on unix systems. On windows the optional parameter must be NULL. This method is used in conjunction with engClose()

Parameters:
startCmdS - start command for engine. Does not work on Windows.

engOpenSingleUse

public long engOpenSingleUse(java.lang.String startCmdS)
Open engine for single use. This command is used to open multiple connections to MATLAB. This method is used in conjunction with engClose( enginePointer )

Parameters:
startCmdS - start command for engine. Does not work on Windows.

engClose

public void engClose()
Close the connection to MATLAB. This method is used in conjunction with engOpen()


engClose

public void engClose(long epL)
Close a specified connection to an instance of MATLAB.

Parameters:
epL - close one connection to the engine, with pointer epL

engCloseAll

public void engCloseAll()
Close all open handles to MATLAB. This methods closes all connections, which have been opened using engOpen() and engOpenSingleUse().


engSetVisible

public void engSetVisible(long epL,
                          boolean engVisB)
Parameters:
epL -
engVisB -

engGetVisible

public boolean engGetVisible(long epL)
Parameters:
epL -
Returns:

engEvalString

public void engEvalString(java.lang.String evalS)
Evaluate an expression in MATLAB's workspace. This function is used for the general engine connection. Usage is in conjuction with engOpen(), engClose()

Parameters:
evalS - String which contains MATLAB commands (e.g. "sin(a);b=rand(3,4)")

engEvalString

public void engEvalString(long epL,
                          java.lang.String evalS)
Evaluate an expression in MATLAB's workspace. This function is used for all connections to MATLAB which have been opened by epL=engOpenSingleUse(), engClose(epL)

Parameters:
epL - pointer to individual connection to the engine
evalS - String which contains MATLAB commands (e.g. "sin(a);b=rand(3,4)")

engGetScalar

public double engGetScalar(java.lang.String arrayS)
Get a scalar value from MATLAB's workspace.

Parameters:
scalar - variable in MATLAB's workspace

engGetScalar

public double engGetScalar(long epL,
                           java.lang.String arrayS)
Get a scalar value from a specified workspace.

Parameters:
epL - pointer to individual connection to the engine
evalS - String which contains MATLAB commands (e.g. "sin(a);b=rand(3,4)")
Returns:
scalar value from the workspace

engGetArray

public double[][] engGetArray(java.lang.String arrayS)
Get an array from MATLAB's workspace.


engGetArray

public double[][] engGetArray(long epL,
                              java.lang.String arrayS)
Get an array from a specified instance/workspace of MATLAB.


engGetCharArray

public java.lang.String[] engGetCharArray(java.lang.String arrayS)
Get an 'char' array (string) from MATLAB's workspace.


engPutArray

public void engPutArray(java.lang.String arrayS,
                        double[][] valuesDD)
Put an array (2 dimensional) into MATLAB's workspace.


engPutArray

public void engPutArray(long epL,
                        java.lang.String arrayS,
                        double[][] valuesDD)
Put an array (2 dimensional) into a specified instance/workspace of MATLAB.


engOutputBuffer

public java.lang.String engOutputBuffer()
Return the outputs of previous commands from MATLAB's workspace.


engOutputBuffer

public java.lang.String engOutputBuffer(long epL,
                                        int buflenI)
Return the ouputs of previous commands in MATLAB's workspace. Right now the parameter buflen is not supported.


setDebug

public void setDebug(boolean debugB)
Switch on or disable debug information printed to standard output.


run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread