convert a py.str to a matlab string

38 ビュー (過去 30 日間)
Xymbu
Xymbu 2022 年 5 月 4 日
回答済み: Al Danial 2022 年 5 月 26 日
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 件のコメント
Stephen23
Stephen23 2022 年 5 月 4 日
string(py.str('hello'))
ans = "hello"
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 Center および File ExchangeCall 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