フィルターのクリア

how to call python file in c s-function

7 ビュー (過去 30 日間)
Diran Liu
Diran Liu 2021 年 10 月 29 日
コメント済み: Diran Liu 2021 年 11 月 3 日
Hello, right now we want to build an MQTT communication between a simulink model and a mqtt broker. We have already a python script that can build an MQTT communication and publish to the broker. We want to call this python script during the simulink simulation using s-function. Since the simulink model is to be loaded onto the real-time simulator opal-rt and the opal-rt builds the simulink model based on c code so we want to write a c-based s-function in simulink to call the python script. But I haven't found many examples implementing in this way. Can someone help? Thanks!

採用された回答

Yongjian Feng
Yongjian Feng 2021 年 10 月 29 日
How about this approach? From C code, you can call system command, right? Run your python script as system command. Use file as input/output.
  1 件のコメント
Diran Liu
Diran Liu 2021 年 11 月 3 日
thanks very much!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by