Is it possible to add a listener to a python object?

11 ビュー (過去 30 日間)
Benjamin Avants
Benjamin Avants 2017 年 12 月 12 日
回答済み: Jayaram Theegala 2017 年 12 月 15 日
I would like for python scripts and objects to be able to trigger a MATLAB callback. Is there any way to do this such as assigning a listener to a python object property or having python raise a MATLAB event or call a MATLAB function?
I've considered using socket communication between python and MATLAB to (essentially) use the java event triggered BytesAvailable function, but that is rather roundabout and requires several different functions and a fair bit of coding.
  1 件のコメント
Benjamin Avants
Benjamin Avants 2017 年 12 月 12 日
Just to clarify, this would be communication between python objects instantiated in MATLAB through direct python calls (py.Module.Class(), etc.).

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

回答 (1 件)

Jayaram Theegala
Jayaram Theegala 2017 年 12 月 15 日
You can use MATLAB Engine API for Python. The following documentation has an example that shows how to call a function in MATLAB from Python: https://www.mathworks.com/help/matlab/matlab_external/call-matlab-functions-from-python.html

カテゴリ

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