Calling a python function from Matlab. Specific function error.

Hello,
I am trying to call a python function in matlab. I tried the example provided in mathworks website which has a file called mymod.py and a function search. I have another file with another function I want to run.. both in the same location.
The mymod.py seems to work perfectly.. but the python file I have keeps giving me this error Undefined variable "py" or class
"py.four.trainNetwork".
I do have to mention that this python code imports from pybrain which is installed on my computer.
I am running matlab on a mac.
Thanks.

댓글 수: 1

hello,
I got the same error as "py.four.trainNetwork", im unable to debug this can u please help me out of these,i have installed pybrain and also its giving same error
I am running matlab on a windows.

댓글을 달려면 로그인하십시오.

답변 (1개)

Saumya Goel
Saumya Goel 2018년 12월 18일

1 개 추천

As per my understanding, this error message might occur due to some issue in user defined python script. You can try the below command:
>> py.importlib.import_module('ScriptName')
Also, you can go through this MATLAB documentation page, which suggests other possible reasons for the mentioned error message.

카테고리

도움말 센터 및 File Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

제품

릴리스

R2017b

질문:

2018년 12월 8일

댓글:

2019년 6월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by