Furkan Gözükara
Furkan Gözükara

Reputation: 23800

How to conver this text file to proper cell array - Matlab

Alright this is the text file

{'samsung','n150','jp0xtr','n570','2gb','320gb','10','w7str'};
{'samsung','n150','jp0xtr','beyaz','intel','atom','n570','66','ghz','2048mb','ddr3','320gb','10','cam','bt','w7str'};
{'samsung','n150','jp0xtr','atom','n570','66ghz','2gb','320gb','10','netbook','w7s','beyaz'};
{'samsung','n150','jp0xtr','atom','n570','66ghz','2gb','320gb','10','netbook','w7s','beyaz'};
{'samsung','n150','jp0xtr','intel','atom','n570','66ghz','2gb','320gb','10','win7starter'};
{'samsung','n150jp0xtr','n570','2g','320gb','10','w7s','beyaz'};
{'samsung','n150','jp0xtr'};
{'samsung','n150','jp0xtr'};

Now i want to load it as the below cell array

enter image description here

I used copy paste here but i want to do that via file reading (text file). How can i do that ? Thank you.

Upvotes: 0

Views: 184

Answers (1)

carandraug
carandraug

Reputation: 13081

Just edit the text file to that it starts with C = { and also ends in } and change the extension to .m. Then run it as if it was a script from matlab command-line.

Next time do not copy and paste, use the save command as in save ('monitor-list.txt', 'C', '-ASCII'). You can then load it easily with load path-to-file.

Upvotes: 1

Related Questions