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

2 visualizzazioni (ultimi 30 giorni)
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 '('.

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 30 Ago 2021
Modificato: MathWorks Support Team il 30 Ago 2021
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.

Più risposte (0)

Prodotti


Release

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by