How to read hypnogram file (.hyp) in matlab

17 次查看(过去 30 天)
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 个评论
Ibrahim kaya
Ibrahim kaya 2020-12-10
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')

请先登录,再进行评论。

采纳的回答

Star Strider
Star Strider 2018-8-25
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 EEG/MEG/ECoG 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by