フィルターのクリア

The simple way to call java code from Simulink

6 ビュー (過去 30 日間)
JIAN PAN
JIAN PAN 2023 年 5 月 31 日
コメント済み: JIAN PAN 2023 年 6 月 4 日
Recently, I was on a project to call java code to achieve zero-mq publish and subscribe function through Matlab. However, I just wondering if I could do the same thing in the Simulink, in other words, if it is possible to directly call java code from simulink . I found a similar question but nearly 10 years ago from the community website, and the answer is thorugh S-function only. Thus, I propose this question again to double check if any new feature of the Simulink allow me to achieve this in a more simple way.
  1 件のコメント
JIAN PAN
JIAN PAN 2023 年 6 月 4 日
Finally, I achieve this by level-2 s-function. And the java object is actullay share with the block through block userdata.

サインインしてコメントする。

採用された回答

Shrey Tripathi
Shrey Tripathi 2023 年 6 月 1 日
You can look at this question and the corresponding answer, which discusses about how to execute Java methods from within the Simulink models. Basically, create an embedded MATLAB function inside the model, which will make use of a Java object to call the methods of that object.
Apart from this, I don't think any new feature of Simulink has been added in recent times to support direct Java calls. The other workaround is by using S-functions. As you mentioned, how to do it is documented in this answer. You can go through the S-functions documentation to see around, if something suits your use case.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeJava Package Integration についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by