Class MatlabEngine
- java.lang.Object
-
- org.eclipse.epsilon.emc.simulink.engine.MatlabEngine
-
public class MatlabEngine extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected Method
closeMethod
protected Method
disconnectMethod
protected Object
engine
protected Method
evalAsyncMethod
protected StringBuilder
evalCommandQueue
protected Method
evalMethod
protected Method
fevalAsyncMethod
protected Method
fevalMethod
protected Method
fevalWithVariableOutputsMethod
protected Method
getVariableAsyncMethod
protected Method
getVariableMethod
protected Set<IGenericSimulinkModel>
models
protected String
project
protected Method
putVariableAsyncMethod
protected Method
putVariableMethod
protected Method
quitMethod
protected StringBuilder
sb
protected Stopwatch
stopWatch
protected Boolean
tryCatchEnabled
-
Constructor Summary
Constructors Constructor Description MatlabEngine()
MatlabEngine(Object engine)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addModel(IGenericSimulinkModel model)
void
close()
static MatlabEngine
connectMatlab()
static MatlabEngine
connectMatlab(String name)
void
disconnect()
void
enableTryCatch(boolean enableTryCatch)
void
eval(String cmd)
void
eval(String cmd, Object... parameters)
This method is now lazily executed.Future<Void>
evalAsync(String cmd)
Object
evalWithResult(String cmd)
Object
evalWithResult(String cmd, Object... parameters)
Object
evalWithSetupAndResult(String setup, String cmd, Object... parameters)
void
feval(int numberOfOutputs, String function, Object... handles)
void
feval(String function, Object... handles)
void
fevalAsync(String function, Object... handles)
Object
fevalWithResult(int numberOfOutputs, String function, Object... handles)
Object
fevalWithResult(String function, Object... handles)
static String[]
findMatlab()
void
flush()
Executes all commands to be executed in the eval method that have been stored in a queue.protected static Class<?>
getMatlabClass()
String
getProject()
Stopwatch
getStopWatch()
StringBuilder
getStream()
Object
getVariable(String variable)
static boolean
is(Object obj)
boolean
isDisconnected()
boolean
isEvalCommandQueueEmpty()
boolean
isReduceExchanges()
Boolean
isTryCatchEnabled()
protected Object
processInputObject(Object o)
protected Object[]
processInputObject(Object[] objects)
void
putVariable(String variableName, Object value)
void
quit()
void
release(IGenericSimulinkModel model)
void
resetTimer()
static void
setEngineClass(Class<?> matlabEngineClass)
void
setProject(String project)
void
setReduceExchanges(boolean reduceExchanges)
static MatlabEngine
startMatlab()
static MatlabEngine
startMatlab(String[] options)
void
trackApi(boolean track)
-
-
-
Field Detail
-
engine
protected Object engine
-
getVariableMethod
protected Method getVariableMethod
-
getVariableAsyncMethod
protected Method getVariableAsyncMethod
-
putVariableMethod
protected Method putVariableMethod
-
putVariableAsyncMethod
protected Method putVariableAsyncMethod
-
evalMethod
protected Method evalMethod
-
evalAsyncMethod
protected Method evalAsyncMethod
-
fevalMethod
protected Method fevalMethod
-
fevalWithVariableOutputsMethod
protected Method fevalWithVariableOutputsMethod
-
fevalAsyncMethod
protected Method fevalAsyncMethod
-
closeMethod
protected Method closeMethod
-
quitMethod
protected Method quitMethod
-
disconnectMethod
protected Method disconnectMethod
-
project
protected String project
-
models
protected Set<IGenericSimulinkModel> models
-
evalCommandQueue
protected StringBuilder evalCommandQueue
-
tryCatchEnabled
protected Boolean tryCatchEnabled
-
sb
protected StringBuilder sb
-
stopWatch
protected Stopwatch stopWatch
-
-
Method Detail
-
getStopWatch
public Stopwatch getStopWatch()
- Returns:
- the stopWatch
-
setEngineClass
public static void setEngineClass(Class<?> matlabEngineClass)
-
trackApi
public void trackApi(boolean track)
-
getStream
public StringBuilder getStream()
-
setProject
public void setProject(String project) throws MatlabException
- Throws:
MatlabException
-
addModel
public void addModel(IGenericSimulinkModel model)
-
getProject
public String getProject()
-
release
public void release(IGenericSimulinkModel model) throws MatlabRuntimeException
- Throws:
MatlabRuntimeException
-
enableTryCatch
public void enableTryCatch(boolean enableTryCatch)
-
isTryCatchEnabled
public Boolean isTryCatchEnabled()
-
evalWithSetupAndResult
public Object evalWithSetupAndResult(String setup, String cmd, Object... parameters) throws MatlabException
- Throws:
MatlabException
-
evalWithResult
public Object evalWithResult(String cmd) throws MatlabException
- Throws:
MatlabException
-
evalWithResult
public Object evalWithResult(String cmd, Object... parameters) throws MatlabException
- Throws:
MatlabException
-
eval
public void eval(String cmd, Object... parameters) throws MatlabException
This method is now lazily executed. All commands are stored in a queue and are only dispatched when the methodflush()
is invoked.- Parameters:
cmd
-parameters
-- Throws:
MatlabException
-
is
public static boolean is(Object obj)
-
getMatlabClass
protected static Class<?> getMatlabClass()
-
startMatlab
public static MatlabEngine startMatlab() throws MatlabException
- Throws:
MatlabException
-
startMatlab
public static MatlabEngine startMatlab(String[] options) throws MatlabException
- Throws:
MatlabException
-
findMatlab
public static String[] findMatlab() throws MatlabException
- Throws:
MatlabException
-
connectMatlab
public static MatlabEngine connectMatlab() throws MatlabException
- Throws:
MatlabException
-
connectMatlab
public static MatlabEngine connectMatlab(String name) throws MatlabException
- Throws:
MatlabException
-
resetTimer
public void resetTimer()
-
eval
public void eval(String cmd) throws MatlabException
- Throws:
MatlabException
-
evalAsync
public Future<Void> evalAsync(String cmd) throws MatlabException
- Throws:
MatlabException
-
getVariable
public Object getVariable(String variable) throws MatlabException
- Throws:
MatlabException
-
fevalWithResult
public Object fevalWithResult(int numberOfOutputs, String function, Object... handles) throws MatlabException
- Throws:
MatlabException
-
feval
public void feval(int numberOfOutputs, String function, Object... handles) throws MatlabException
- Throws:
MatlabException
-
fevalWithResult
public Object fevalWithResult(String function, Object... handles) throws MatlabException
- Throws:
MatlabException
-
feval
public void feval(String function, Object... handles) throws MatlabException
- Throws:
MatlabException
-
putVariable
public void putVariable(String variableName, Object value) throws MatlabException
- Throws:
MatlabException
-
fevalAsync
public void fevalAsync(String function, Object... handles) throws MatlabException
- Throws:
MatlabException
-
close
public void close() throws MatlabException
- Throws:
MatlabException
-
quit
public void quit() throws MatlabException
- Throws:
MatlabException
-
disconnect
public void disconnect() throws MatlabException
- Throws:
MatlabException
-
flush
public void flush() throws MatlabException
Executes all commands to be executed in the eval method that have been stored in a queue.- Throws:
MatlabException
-
isEvalCommandQueueEmpty
public boolean isEvalCommandQueueEmpty()
-
setReduceExchanges
public void setReduceExchanges(boolean reduceExchanges)
- Parameters:
reduceExchanges
-
-
isReduceExchanges
public boolean isReduceExchanges()
-
-