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 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