Usage of "Matlab python engine" from python executed by Matlab

2 views (last 30 days)
To reproduce the error, set up an Matlab + python environment with installed matlab.engine.
Executing the code
py.importlib.import_module('matlab.engine')
gives the following error message:
Error using enginesession>__init__ (line 8)
Python Error: EngineError: MATLAB process session cannot be initialized.
Error in __init__><module> (line 80)
_session = EngineSession()
Error in <frozen importlib>_call_with_frames_removed (line 222)
Error in <frozen importlib>exec_module (line 673)
Error in <frozen importlib>_load_unlocked (line 673)
Error in <frozen importlib>_find_and_load_unlocked (line 958)
Error in <frozen importlib>_find_and_load (line 969)
Error in <frozen importlib>_gcd_import (line 986)
Error in __init__>import_module (line 126)
return _bootstrap._gcd_import(name[level:], package, level)
The basic problem I want to solve by using matlab.engine is to have callbacks from python to Matlab. The trivial solution "passing function handles" is not possible. Is there a different approach possible?

Answers (0)

Community Treasure Hunt

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

Start Hunting!