Recursive calls Matlab <--> Python
1 回表示 (過去 30 日間)
古いコメントを表示
I want to call a python script from Matlab. At the same time, this python script will perform recursive calls to Matlab scripts.
Here is how it is implemented in Matlab:
matlab.engine.shareEngine
py.importlib.import_module('call_python_pso')
py.call_python_pso.execute_pso()
In Python:
import matlab.engine
from pyswarm import pso
import sys
The error I get in py.importlib.import_module('call_python_pso'):
Error using enginesession>__init__ (line 8)
Python Error: EngineError: MATLAB process session cannot be initialized.
Error in __init__><module> (line 82)
_session = EngineSession()
Error in call_python_pso><module> (line 1)
import matlab.engine
Error in <frozen importlib>_call_with_frames_removed (line 219)
Error in <frozen importlib>exec_module (line 678)
Error in <frozen importlib>_load_unlocked (line 665)
Error in <frozen importlib>_find_and_load_unlocked (line 955)
Error in <frozen importlib>_find_and_load (line 971)
Error in <frozen importlib>_gcd_import (line 994)
Error in __init__>import_module (line 126)
return _bootstrap._gcd_import(name[level:], package, level)
Is this really possible to be accomplished: Matlab<-->Python? It seems that half of a dozen persons raised this same question in the forum but I could not identify convenient answers.
Matlab R2018a + Anaconda Python 3.5 Thanks in advance, Lucas
0 件のコメント
回答 (1 件)
NISARGA G K
2018 年 3 月 22 日
Calling Python Script that imports the Matlab python engine is not a supported workflow.
1 件のコメント
Ahmed Abida
2021 年 3 月 12 日
Hallo NISARGA and Lucas, is there any documentation/link for it ? the same pb is happening Matlab2020b + python3.6
参考
カテゴリ
Help Center および File Exchange で Call MATLAB from Python についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!