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 Center および File ExchangeCall Python from MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by