matlab actor always stops matlab process in wrapup
The matlab actor always stops the matlab process when model execution ends. It would be nice if the actor could (optionally) keep it running. This functionality would be useful, for example, to continue displaying matlab plots after the model completes, or reuse the matlab process for subsequent model executions.
The difficulty in implementing this is knowing when to stop the matlab process. It should be done before the JVM exits. I don't think finalize() is a solution since it is not always called.
#1 Updated by Daniel Crawl over 13 years ago
In order for the matlab process to persist after model execution, an engine cannot be opened in an actor's thread.
The ability to open an instance of the MATLAB Engine in one thread and pass control of it to another thread is not available in MATLAB. When the thread that calls engOpen terminates, all resources for the Engine application also terminate. There are currently no known workarounds.