[FieldTrip] edf import error

Steph bick bick35 at gmail.com
Wed Jan 23 23:40:54 CET 2019


Dear fieldtrip experts,

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.
I’m using a macbook pro Mojave, and FieldTrip revision beead1127.

Any help is highly appreciated. Thank you!

Stephan



But run into this error:
Index exceeds matrix dimensions.

Error in read_edf (line 129)
    if EDF.T0(1) < 91

Error in ft_read_header (line 787)
      hdr = read_edf(filename);

Error in ft_preprocessing (line 397)
  hdr = ft_read_header(cfg.headerfile, 'headerformat', cfg.headerformat,...

I am running this command:

cfg=[];

cfg.dataset = '/Users/tst/Downloads/test.edf';

data = ft_preprocessing(cfg)

What I tried
This is the snipped of read_edf where it gets stuck (in bold is line 129).

  H1=char(fread(EDF.FILE.FID,256,'char')');

  EDF.VERSION=H1(1:8);                          % 8 Byte  Versionsnummer

  %if 0 fprintf(2,'LOADEDF: WARNING  Version EDF Format %i',ver); end

  EDF.PID = deblank(H1(9:88));                  % 80 Byte local patient identification

  EDF.RID = deblank(H1(89:168));                % 80 Byte local recording identification

  %EDF.H.StartDate = H1(169:176);               % 8 Byte

  %EDF.H.StartTime = H1(177:184);               % 8 Byte

  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])) ];


  % Y2K compatibility until year 2090
  if EDF.VERSION(1)=='0'
    if EDF.T0(1) < 91
      EDF.T0(1)=2000+EDF.T0(1);
    else
      EDF.T0(1)=1900+EDF.T0(1);
    end
  else
    % in a future version, this is hopefully not needed
  End


Some outputs at this stage:
K>> EDF.T0
ans =     []

K>> EDF
EDF =

  struct with fields:

        FILE: [1×1 struct]
    FileName: '/Users/tst/Downloads/NS136_Day4_Seizure1_clipANON.edf'
     VERSION: '0       '
         PID: 'ReX'
         RID: ''
          T0: []

K>> H1
H1 =
    '0       ReX

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:
EDF =

  struct with fields:

        FILE: [1×1 struct]
    FileName: '/Users/tst/Downloads/NewFile.edf'
     VERSION: '0       '
         PID: 'X X X X'
         RID: 'Startdate 23-JAN-2019 X X AnyWave_EDF+_exporter'
          T0: [19 1 23 16 49 29]

K>> H1
H1 =
    '0       X X X X                                                                         Startdate 23-JAN-2019 X X AnyWave_EDF+_exporter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190123/710eeda3/attachment-0001.html>


More information about the fieldtrip mailing list