Importing a list of tuples genrated in python to MATLAB

조회 수: 2 (최근 30일)
Deepa Maheshvare
Deepa Maheshvare 2018년 12월 2일
댓글: Deepa Maheshvare 2018년 12월 2일
I have a list of tuples generated in python. The list is save in a text file and loaded in MATLAB.
[(2, 4), (2, 12), (2, 8)]
I'd like to import the list in MATLAB as a matrix?
Any suggestion on how this can be done?

답변 (1개)

madhan ravi
madhan ravi 2018년 12월 2일
matrix=load('mytext.txt')
  댓글 수: 9
madhan ravi
madhan ravi 2018년 12월 2일
See the example below:
>> py.list({py.list([1,2]),py.list([3,4])})
ans =
Python list with no properties.
[[1.0, 2.0], [3.0, 4.0]]
>>
Deepa Maheshvare
Deepa Maheshvare 2018년 12월 2일
The problem is I am not able to import the file using load function

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by