Hello,
I need to pass a number of arguments to python function in Matlab. One of them is a string array like {'red', 'green'}.
I am creating a python list with py.list({'red', 'green'}) and insert the result as an argument into the python function.
The error message that I get is:
'Conversion of MATLAB 'string' array to Python is not supported.'
How to do this correctly?
Thank you
Anna
P.S. The issue is solved. No problem with creating and passing lists, it was just a weird string in argument.

 채택된 답변

Yongjian Feng
Yongjian Feng 2021년 8월 16일

0 개 추천

Which version of matlab are you using? This is the doc of R2021a:

댓글 수: 3

Anna Gossen
Anna Gossen 2021년 8월 16일
Hi,
I am using 2020a. But the reason was that the argument was built in a weird way. So, the issue is solved. Sorry, I just couldn't find the question to close it.
Thanks
Newton Campbell
Newton Campbell 2022년 9월 5일
Wait. So what was the solve for this? How did you construct the argument?
Leo
Leo 2023년 5월 4일
I had the same error in R2022b.
Solved it by changing string array to cell array with strings.
>>> x = ["bob", "cat"] does not work.
Conversion of MATLAB 'string' array to Python is not supported.
>>> x = {"bob", "cat"} works

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

추가 답변 (0개)

카테고리

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

제품

릴리스

R2020a

태그

질문:

2021년 8월 16일

댓글:

Leo
2023년 5월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by