Filter löschen
Filter löschen

How can I read unformated text from txt file?

1 Ansicht (letzte 30 Tage)
Javier Saiz
Javier Saiz am 5 Dez. 2017
Beantwortet: Elizabeth Reese am 7 Dez. 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

Antworten (1)

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

Kategorien

Mehr zu Data Import and Analysis finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by