Effacer les filtres
Effacer les filtres

convert a py.str to a matlab string

43 vues (au cours des 30 derniers jours)
Xymbu
Xymbu le 4 Mai 2022
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 commentaires
Stephen23
Stephen23 le 4 Mai 2022
string(py.str('hello'))
ans = "hello"
Xymbu
Xymbu le 4 Mai 2022
This is exactly it. Do you want to put it as an answer so I can accept it as that?

Connectez-vous pour commenter.

Réponse acceptée

Xymbu
Xymbu le 24 Mai 2022
string(py.str('hello'))

Plus de réponses (1)

Al Danial
Al Danial le 26 Mai 2022
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.

Catégories

En savoir plus sur Call Python from MATLAB dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by