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

2 visualizaciones (últimos 30 días)
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 '('.

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 10 de Nov. de 2025
Editada: MathWorks Support Team el 10 de Nov. de 2025
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.

Más respuestas (0)

Categorías

Más información sobre Call Python from MATLAB en Help Center y File Exchange.

Productos


Versión

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by