How to read hypnogram file (.hyp) in matlab

5 Ansichten (letzte 30 Tage)
androw jackson
androw jackson am 25 Aug. 2018
Kommentiert: Ibrahim kaya am 10 Dez. 2020
Hello, I want to know how to open .hyp file (hypnogram of sleep stage analysis from physionet.org) in matlab? my file format is not ''.edf''. the format of my file is ''.hyp''. the edfread function can not open it in matlab. I test it. thanks
  1 Kommentar
Ibrahim kaya
Ibrahim kaya am 10 Dez. 2020
You can use the following commands in python to convert edf to csv
Then importing csv to Matlab is easy:
import pyedflib
import pandas
import csv
f = pyedflib.EdfReader("SC4001EC-Hypnogram.edf")
annotations = f.readAnnotations()
with open("Test.csv",'w') as fo:
for d in range(len(annotations[0])):
fo.write(str(annotations[0][d])+','+str(annotations[1][d])+','+annotations[2][d]+'\n')

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Star Strider
Star Strider am 25 Aug. 2018
Files with a ‘.hyp’ extension are annotation files. They are intended to be used by the Physionet software, not read individually. Not all sleep data are annotated. (Since they are ASCII files, MATLAB can open the files and import them with the fgets function. Making sense of them afterwards is another problem.)
Go back to PhysioBank ATM (link), choose the record you want, and in the ‘Toolbox’ pull-down menu, select ‘Export signals as .mat’. The signals, and annotations (if they exist) should be in that file, that you can then open with the MATLAB load (link) function.
For best results, assign them to a variable, described in Load List of Variables into Structure Array (link).
I have some experience with PhysioNET files, but none with the polysomnographic data, so I cannot help you further with them.

Weitere Antworten (0)

Kategorien

Mehr zu EEG/MEG/ECoG 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