Effacer les filtres
Effacer les filtres

Recursive calls Matlab <--> Python

1 vue (au cours des 30 derniers jours)
Lucas Carneiro
Lucas Carneiro le 19 Mar 2018
Commenté : Ahmed Abida le 12 Mar 2021
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

Réponses (1)

NISARGA G K
NISARGA G K le 22 Mar 2018
Calling Python Script that imports the Matlab python engine is not a supported workflow.
  1 commentaire
Ahmed Abida
Ahmed Abida le 12 Mar 2021
Hallo NISARGA and Lucas, is there any documentation/link for it ? the same pb is happening Matlab2020b + python3.6

Connectez-vous pour commenter.

Catégories

En savoir plus sur Call MATLAB from Python dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by