Recursive calls Matlab <--> Python
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
NISARGA G K
am 22 Mär. 2018
Calling Python Script that imports the Matlab python engine is not a supported workflow.
1 Kommentar
Ahmed Abida
am 12 Mär. 2021
Hallo NISARGA and Lucas, is there any documentation/link for it ? the same pb is happening Matlab2020b + python3.6
Siehe auch
Kategorien
Mehr zu Call MATLAB from Python finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!