How can I read unformated text from txt file?

6 次查看(过去 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

回答(1 个)

Elizabeth Reese
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.

类别

Help CenterFile Exchange 中查找有关 Data Import and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by