[FieldTrip] ft_read_header and ft_definetrial errors

Tate, Lindsey R. lindseyrtate at ou.edu
Wed Mar 28 09:30:23 CEST 2018

Hello fieldtrip community,

I have a dataset I've been working with in EEGLAB, but I am now trying to use it in Fieldtrip. The dataset is a concatenation of extracted epochs from multiple participants. The data imports fine as an EDF. However, EEGLAB's formatting for epochs means that there aren't triggers in the data. I have made my own header and trigger files in BrainVision format (I did it this way because I had BrainVision files to mimic, and it's listed on http://www.fieldtriptoolbox.org/reference/ft_read_header as an acceptable format). My events read in fine with the *.vmrk file I have.

My problem is that I haven't figured out how to read in the *.vhdr file I have successfully. When I've tried to read it in, it gives me an error that it can't identify the dataset that the header goes with. Without it, I get the error below that *.vmrk isn't an accepted header file format.

I have two questions:

(1) Am I right in my interpretation that the error I'm getting below is because I haven't read in the *.vhdr header file? If that's not correct, what does the error mean?

(2) How can I read in the *.vhdr header file I have?

The following is the code:

%%file information
AMBB = 'AM';
stimfreq = '6';
pathway = 'Z:\BB\Preprocessing\';
datafile = [pathway AMBB stimfreq '_3s_avgepoch_5.edf'];
eventfile = [pathway AMBB stimfreq '_3s_avgepoch_5_ftevents.vmrk'] ;
hdrfile = [pathway AMBB stimfreq '_3s_avgepoch_5_ftevents.vhdr'];
output6 = [pathway AMBB stimfreq '_dics6.mat'];
output12 = [pathway AMBB stimfreq '_dics12.mat'];
output25 = [pathway AMBB stimfreq '_dics25.mat'];
output50 = [pathway AMBB stimfreq '_dics50.mat'];
%%read in events
[event] = ft_read_event(eventfile);
%%define trials
cfg = [];
cfg.trialdef.eventvalue = 2 ;
cfg.trialdef.prestim    = 1 ;
cfg.trialdef.poststim   = 3 ;
cfg.dataset      = eventfile ;
cfg.trialfun     = 'ft_trialfun_general';
[cfg] = ft_definetrial(cfg);

The following is the output:

evaluating trialfunction 'ft_trialfun_general'
Error using ft_notification (line 340)
unsupported header format "brainvision_vmrk"

Error in ft_error (line 39)

Error in ft_read_header (line 2478)
        ft_error('unsupported header format "%s"', headerformat);

Error in ft_trialfun_general (line 78)
hdr = ft_read_header(cfg.headerfile, 'headerformat',

Error in ft_definetrial (line 178)
    [trl, event] = feval(cfg.trialfun, cfg);


The *.vhdr and *.vmrk files are attached for reference.

Thank you for any help or insight you can provide.

Lindsey Tate

PhD Candidate

University of Oklahoma

lindseyrtate at ou.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20180328/b9600e87/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: AM6_3s_avgepoch_5_ftevents.vmrk
Type: application/octet-stream
Size: 42028 bytes
Desc: AM6_3s_avgepoch_5_ftevents.vmrk
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20180328/b9600e87/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: AM6_3s_avgepoch_5_ftevents.vhdr
Type: application/octet-stream
Size: 9763 bytes
Desc: AM6_3s_avgepoch_5_ftevents.vhdr
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20180328/b9600e87/attachment-0003.obj>

More information about the fieldtrip mailing list