MATLAB Engine API for Python error??

5 ビュー (過去 30 日間)
Teresita Ramirez Aguilar
Teresita Ramirez Aguilar 2019 年 8 月 19 日
回答済み: Kojiro Saito 2019 年 8 月 21 日
I am using MATLAB Engine API for Python but I keep getting this error when I run my script with python. I am new to both Matlab and the engine, when I run this command:
find(any(any(I,3),1),1,'last')
on the matlab prompt it works fine....
error:
File "Get_Coordinates.py", line 11, in <module>
eng.find(any(any(I,3),1),1,'last')
TypeError: any() takes exactly one argument (2 given)
python script:
import matlab.engine
eng = matlab.engine.start_matlab()
I=eng.imread('whitewave.png')
eng.imshow(I)
eng.find(any(I),1);
eng.find(any(any(I,3),1),1,'last')

回答 (1 件)

Kojiro Saito
Kojiro Saito 2019 年 8 月 21 日
It's because you're inputting Python's any function (document of any in Python 3). It is not fully compatible with any function of MATLAB (document of any in MATLAB).
If you want to input MATLAB's any, you can use by eng.any.
eng.find(eng.any(eng.any(I,3),1),1,'last')

カテゴリ

Help Center および File ExchangeCall MATLAB from Python についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by