Importing a list of tuples genrated in python to MATLAB
Show older comments
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?
Answers (1)
madhan ravi
on 2 Dec 2018
matrix=load('mytext.txt')
9 Comments
Deepa Maheshvare
on 2 Dec 2018
Deepa Maheshvare
on 2 Dec 2018
Edited: Deepa Maheshvare
on 2 Dec 2018
madhan ravi
on 2 Dec 2018
upload the text file here
Deepa Maheshvare
on 2 Dec 2018
Deepa Maheshvare
on 2 Dec 2018
Deepa Maheshvare
on 2 Dec 2018
madhan ravi
on 2 Dec 2018
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
on 2 Dec 2018
Categories
Find more on Call Python from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!