public class MatlabInterface
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
double[][] |
arrayFromMatlab(java.lang.String matlabName)
Takes the MATLAB array named by
matlabName and returns the
corresponding double[][] object, with values assigned in
row-major order. |
static MatlabInterface |
create() |
void |
dispose() |
boolean |
errorOccurred() |
java.lang.Exception |
getError() |
boolean |
isConnected() |
Matrix |
matrixFromMatlab(java.lang.String matlabName)
Takes the MATLAB array named by
matlabName and returns a
corresponding Matrix object. |
void |
objectToMatlab(java.lang.Object obj,
java.lang.String matlabName)
Sets the MATLAB array named
matlabName to the values
associated with the ArtiSynth object obj . |
VectorNd |
vectorFromMatlab(java.lang.String matlabName)
Takes the MATLAB array named by
matlabName and returns a
corresponding VectorNd object. |
public void objectToMatlab(java.lang.Object obj, java.lang.String matlabName) throws MatlabInterfaceException
matlabName
to the values
associated with the ArtiSynth object obj
. The ArtiSynth
object must be either a Matrix
, Vector
, or double[][]
. The MATLAB
array is dense, unless the ArtiSynth object is an instance of SparseMatrix
, in which the assigned array is
sparse.obj
- ArtiSynth objecymatlabName
- name of the MATLAB arrayMatlabInterfaceException
- if communication with MATLAB failspublic double[][] arrayFromMatlab(java.lang.String matlabName) throws MatlabInterfaceException
matlabName
and returns the
corresponding double[][]
object, with values assigned in
row-major order. If the named MATLAB array does not exist, or is not
dense and 2-dimensional, then null
is returned.matlabName
- name of the MATLAB arrayMatlabInterfaceException
- if communication with MATLAB failspublic Matrix matrixFromMatlab(java.lang.String matlabName) throws MatlabInterfaceException
matlabName
and returns a
corresponding Matrix
object. If the named
MATLAB array does not exist, or is not 2-dimensional, then
null
is returned. Otherwise, either a MatrixNd
or SparseMatrixNd
is returned, depending on whether the array is dense or
sparse.matlabName
- name of the MATLAB arrayMatlabInterfaceException
- if communication with MATLAB failspublic VectorNd vectorFromMatlab(java.lang.String matlabName) throws MatlabInterfaceException
matlabName
and returns a
corresponding VectorNd
object. If the
named MATLAB array does not exist, or is not 2-dimensional with a size of
1 in at least one dimension, then null
Is returned.matlabName
- name of the MATLAB arrayMatlabInterfaceException
- if communication with MATLAB failspublic void dispose()
public boolean errorOccurred()
public java.lang.Exception getError()
public boolean isConnected()
public static MatlabInterface create() throws MatlabInterfaceException
MatlabInterfaceException