How can I read unformated text from txt file?

3 vues (au cours des 30 derniers jours)
Javier Saiz
Javier Saiz le 5 Déc 2017
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

Réponses (1)

Elizabeth Reese
Elizabeth Reese le 7 Déc 2017
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.

Catégories

En savoir plus sur Standard File Formats dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by