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

조회 수: 7 (최근 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 CenterFile Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by