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

조회 수: 5 (최근 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 2025년 11월 10일
편집: MathWorks Support Team 2025년 11월 10일
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