Instantiate a Java Class and call Matlab Engine API for Java in the same session

7 ビュー (過去 30 日間)
Francisco Campos
Francisco Campos 2023 年 5 月 1 日
回答済み: colordepth 2024 年 12 月 24 日
Hello, I am trying to use the Matlab Engine API for Java in a situation that I am not sure is supported.
My goal is to have a Java object that was instantiated in a Matlab sessin to call a Matlab function (to be executed in the same session).
However, when I tried this I obtained the error: Initializing MATLAB Engine API from MATLAB is not supported.
Do you confirm that this context is not compatible with the Matlab Engine API?
Many thanks

回答 (1 件)

colordepth
colordepth 2024 年 12 月 24 日
This workflow is supported starting with MATLAB R2021b. You can find more details in the version history here: https://www.mathworks.com/help/matlab/apiref/com.mathworks.engine.matlabengine.html.
For a working example, you can refer to the guide "Call Back into MATLAB from Java": https://www.mathworks.com/help/matlab/matlab_external/call-back-into-matlab-from-java.html.

カテゴリ

Help Center および File ExchangeCall MATLAB from Java についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by