<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Courier;
panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
p.p1, li.p1, div.p1
{mso-style-name:p1;
margin:0in;
margin-bottom:.0001pt;
font-size:7.5pt;
font-family:Courier;}
p.p2, li.p2, div.p2
{mso-style-name:p2;
margin:0in;
margin-bottom:.0001pt;
font-size:7.5pt;
font-family:Courier;
color:#A020F0;}
span.s1
{mso-style-name:s1;
color:black;}
span.s2
{mso-style-name:s2;
color:#A020F0;}
p.p3, li.p3, div.p3
{mso-style-name:p3;
margin:0in;
margin-bottom:.0001pt;
font-size:9.0pt;
font-family:Courier;}
span.apple-converted-space
{mso-style-name:apple-converted-space;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">Dear fieldtrip experts, <o:p>
</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">I exported an EEG file to edf from our clinical system (Natus XLTEK) and am trying to import it. Below I pasted the error and what I tried.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">I’m using a macbook pro Mojave, and FieldTrip revision beead1127.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Any help is highly appreciated. Thank you!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Stephan<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt">But run into this error:<o:p></o:p></span></b></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Index exceeds matrix dimensions.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Error in read_edf (line 129)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> if EDF.T0(1) < 91<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Error in ft_read_header (line 787)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> hdr = read_edf(filename);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Error in ft_preprocessing (line 397)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> hdr = ft_read_header(cfg.headerfile, 'headerformat', cfg.headerformat,...<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt">I am running this command:<o:p></o:p></span></b></p>
<p class="p1">cfg=[];<o:p></o:p></p>
<p class="p2"><span class="s1">cfg.dataset = </span>'/Users/tst/Downloads/test.edf'<span class="s1">;</span><o:p></o:p></p>
<p class="p1">data = ft_preprocessing(cfg)<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><b>What I tried<o:p></o:p></b></p>
<p class="MsoNormal">This is the snipped of read_edf where it gets stuck (in bold is line 129).
<o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span>H1=char(fread(EDF.FILE.FID,256,<span class="s1">'char'</span>)');<o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span>EDF.VERSION=H1(1:8);<span class="apple-converted-space">
</span><span class="s2">% 8 Byte</span><span class="apple-converted-space"><span style="color:forestgreen">
</span></span><span class="s2">Versionsnummer</span><o:p></o:p></p>
<p class="p2"><span class="apple-converted-space"><span style="color:black"> </span>
</span>%if 0 fprintf(2,'LOADEDF: WARNING<span class="apple-converted-space"> </span>
Version EDF Format %i',ver); end<o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span>EDF.PID = deblank(H1(9:88));<span class="apple-converted-space">
</span><span class="s2">% 80 Byte local patient identification</span><o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span>EDF.RID = deblank(H1(89:168));<span class="apple-converted-space">
</span><span class="s2">% 80 Byte local recording identification</span><o:p></o:p></p>
<p class="p2"><span class="apple-converted-space"><span style="color:black"> </span>
</span>%EDF.H.StartDate = H1(169:176); <span class="apple-converted-space">
</span>% 8 Byte<o:p></o:p></p>
<p class="p2"><span class="apple-converted-space"><span style="color:black"> </span>
</span>%EDF.H.StartTime = H1(177:184); <span class="apple-converted-space">
</span>% 8 Byte<o:p></o:p></p>
<p class="p1"><span class="apple-converted-space"> </span>EDF.T0=[str2num(H1(168+[7 8])) str2num(H1(168+[4 5])) str2num(H1(168+[1 2])) str2num(H1(168+[9 10])) str2num(H1(168+[12 13])) str2num(H1(168+[15 16])) ];<o:p></o:p></p>
<p class="p3"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:Courier;color:black">
</span><span style="font-size:7.5pt;font-family:Courier;color:forestgreen">% Y2K compatibility until year 2090<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:Courier"> <span style="color:blue">
if</span> EDF.VERSION(1)==<span style="color:#A020F0">'0'</span><o:p></o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:7.5pt;font-family:Courier"> <span style="color:blue">
if</span> EDF.T0(1) < 91<o:p></o:p></span></b></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:Courier"> EDF.T0(1)=2000+EDF.T0(1);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:Courier"> <span style="color:blue">
else</span><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:Courier"> EDF.T0(1)=1900+EDF.T0(1);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:Courier"> <span style="color:blue">
end</span><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:Courier;color:black">
</span><span style="font-size:7.5pt;font-family:Courier;color:blue">else<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:Courier;color:black">
</span><span style="font-size:7.5pt;font-family:Courier;color:forestgreen">% in a future version, this is hopefully not needed<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:Courier;color:black">
</span><span style="font-size:7.5pt;font-family:Courier;color:blue">End<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:Courier;color:blue"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:Courier;color:blue"><o:p> </o:p></span></p>
<p class="MsoNormal"><b>Some outputs at this stage:<o:p></o:p></b></p>
<p class="MsoNormal">K>> EDF.T0<o:p></o:p></p>
<p class="MsoNormal">ans = []<br>
<br>
<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">K>> EDF<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">EDF = <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> struct with fields:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> FILE: [1×1 struct]<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> FileName: '/Users/tst/Downloads/NS136_Day4_Seizure1_clipANON.edf'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> VERSION: '0 '<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> PID: 'ReX'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> RID: ''<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> T0: []<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">K>> H1<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">H1 =<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> '0 ReX <o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">IF I import the edf to an EEG viewer and export from that software again, the import works. It seems that the export writes additional info to what is read into H1. The outputs at the same stage of import for this new file is:<o:p></o:p></p>
<p class="MsoNormal">EDF = <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> struct with fields:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> FILE: [1×1 struct]<o:p></o:p></p>
<p class="MsoNormal"> FileName: '/Users/tst/Downloads/NewFile.edf'<o:p></o:p></p>
<p class="MsoNormal"> VERSION: '0 '<o:p></o:p></p>
<p class="MsoNormal"> PID: 'X X X X'<o:p></o:p></p>
<p class="MsoNormal"> RID: 'Startdate 23-JAN-2019 X X AnyWave_EDF+_exporter'<o:p></o:p></p>
<p class="MsoNormal"> T0: [19 1 23 16 49 29]<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">K>> H1<o:p></o:p></p>
<p class="MsoNormal">H1 =<o:p></o:p></p>
<p class="MsoNormal"> '0 X X X X Startdate 23-JAN-2019 X X AnyWave_EDF+_exporter<o:p></o:p></p>
</div>
</body>
</html>