convert a py.str to a matlab string

31 次查看(过去 30 天)
I used a python function which returns a py.str format and im not sure how to convert it to a matlab string so I can use matlab functions on it.
  2 个评论
Xymbu
Xymbu 2022-5-4
This is exactly it. Do you want to put it as an answer so I can accept it as that?

请先登录,再进行评论。

采纳的回答

Xymbu
Xymbu 2022-5-24
string(py.str('hello'))

更多回答(1 个)

Al Danial
Al Danial 2022-5-26
For generic conversion of Python variables to MATLAB variables, try py2mat.m, and for the reverse (Python to MATLAB), mat2py.m.
These MATLAB items are supported: strings, char arrays, cell arrays, dense matrices, sparse matrices, datetimes. On the Python side: dicts, lists, sets, tuples, NumPy arrays, SciPy sparse arrays, datetimes.

类别

Help CenterFile Exchange 中查找有关 Call Python from MATLAB 的更多信息

标签

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by