How to read hypnogram file (.hyp) in matlab

조회 수: 7 (최근 30일)
androw jackson
androw jackson 2018년 8월 25일
댓글: Ibrahim kaya 2020년 12월 10일
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