MATLAB Answers

String array from Matlab to Python

15 views (last 30 days)
Anna Gossen
Anna Gossen on 16 Aug 2021
Edited: Anna Gossen on 16 Aug 2021
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.

Accepted Answer

Yongjian Feng
Yongjian Feng on 16 Aug 2021
Which version of matlab are you using? This is the doc of R2021a:
  1 Comment
Anna Gossen
Anna Gossen on 16 Aug 2021
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

Sign in to comment.

More Answers (0)

Tags

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!