How can I read unformated text from txt file?
3 次查看(过去 30 天)
显示 更早的评论
I am trying to read a txt files with annotations in order to process EEG signals. I attach the txt file What I would like to have is something in the lines of a structure or matrix where I could have in the same or different structures the headers and the time. Something along the lines of:
[Occhi aperti , 361.078
Stringe i pugni , 370.859
Rilascia i pugni , 381.031
Occhi chiusi , 405.219
Occhi aperti , 580.797...]
Thank you very much
0 个评论
回答(1 个)
Elizabeth Reese
2017-12-7
I recommend playing around with the Import Tool. I was able to take your file and import it as a table with the first variable being strings with the text from within the [] brackets and the second being a double of the value in the before the "None". To do this, I added custom column delimiters ([, ], and ') to separate the columns from one another and checked "Treat Multiple Delimiters as One" in the delimiter options. I imported the first column as "Text" and the second as a number and named the variables Headers and Time respectively.
Here is what the tool looked like when I was done and what the output was.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Standard File Formats 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!