Error to run Python in MATLAB functions

2 visualizaciones (últimos 30 días)
Farshid Daryabor
Farshid Daryabor el 4 de Mzo. de 2020
Respondida: Dhruv el 1 de Abr. de 2025
I am trying to run the attached 'merge_profiles.py' I has written in matlab, I don't know really the error come from where.
>> py.merge_profiles();
Undefined variable "py" or class "py.merge_profiles".
While I can run example one. I thanks anybody help me.
>> py.hello.world()
ans =
Python str with no properties.
hello world

Respuestas (1)

Dhruv
Dhruv el 1 de Abr. de 2025
It looks like you are trying to run a Python script, "merge_profiles.py", from MATLAB but are encountering an issue with MATLAB not recognizing the Python module. Here are some steps you can take to troubleshoot and resolve the issue:
  • Verify Python Environment Setup in MATLAB: Ensure MATLAB is configured to use the correct Python environment. You can check the current Python environment by executing:
>> pyenv
You may refer to the below documentation for more details:
I hope this helps!

Categorías

Más información sobre Call Python from MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by