Using python inside MATLAB: unexpected results when printing Python list inside MATLAB

2 次查看(过去 30 天)
I would like to print the python list inside MATLAB. However, instead of printing the first element of the list, it prints the '(', that is, it considers the list as a string and prints the first character of that string which is '('.

采纳的回答

MathWorks Support Team
编辑:MathWorks Support Team 2021-8-30
The MATLAB automatically converts compatible Python data to MATLAB data. For Python types that do not have compatible MATLAB types, MATLAB provides functions to convert Python data types to MATLAB types manually. 
For Python types that do not have compatible MATLAB types, such as list in this case, use the MATLAB functions shown in the Explicit Type Conversion table. This table also describes how to convert strings and certain numeric types explicitly.
Please refer to the below links for your reference which gives more information about Python types that do not have compatible MATLAB types:
Please use 'cell' (refer to the below link) MATLAB conversion to convert list into a MATLAB compatible data types.

更多回答(0 个)

类别

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

产品


版本

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by