[FieldTrip] Question about ft_definetrials

justyna marie justyna_marie at yahoo.com
Thu Feb 16 13:51:59 CET 2017

Hi Anne,
Many thanks for your advice. I have finally got this fixed!
I tried to  check the event type but at first I couldn't use the line (cfg.trialdef.eventtype='?') -- it turned out there was no events list imported which I managed to overlook. To fix it I first used:event = ft_read_event(''filename.set') and then check the event type in fieldtrip with the line you sent. Once I'd done this I could then use the event type in my old code. Thanks again as I wouldn't think about it if not for your suggestion.

      From: anne Hauswald <anne.hauswald at me.com>
 To: justyna marie <justyna_marie at yahoo.com>; FieldTrip discussion list <fieldtrip at science.ru.nl> 
 Sent: Thursday, 16 February 2017, 8:05
 Subject: Re: [FieldTrip] Question about ft_definetrials
Hi Justyna, 
I just scanned your code, but just to be sure: did you check your event type with fieldtrip?
For my EEG data e.g. the event type is ‚Stimulus‘.You can check it with the following codecfg = [];
cfg.dataset            = 'yourfile.ext';
cfg.trialdef.eventtype = '?';
Best Anne

Am 15.02.2017 um 22:13 schrieb justyna marie <justyna_marie at yahoo.com>:
Dear community members,
I am new to Fieldtrip therefore would very much appreciate your advice on the following:I have been trying to convert my pre-processed and segmented EEG data from eeglab .set format to Fieldtrip to perform some analyses. My data contains epochs marked by 5 types of trigger values ('3','4','5','6','7'). 
I used:
mydata = eeglab2fieldtrip (EEG, 'preprocessing');

to convert between data formats and then build condition corresponding to my markers  with cfg.trialdef structure but unfortunately I keep getting the following message:
Error using ft_definetrial (line 188)no trials were defined, see FT_DEFINETRIAL for help
I then tried to define the trial structure with the following script:
eventValues = {'3','4','5','6','7'};prepost = [0.2 1.7];ftype = 'eeglab_set';data = struct;for evVal = 1:length(eventValues)    infile = fullfile(strcat('D:\Exp_8\EEG_ analyses\filename', [eventValues{evVal}],'.set'));    cfg = [];    cfg.dataset = infile;    cfg.headerfile = infile;    cfg.dataformat = ftype;    cfg.headerformat = ftype;       cfg.continuous = 'no';    cfg.trialdef.prestim = prepost(1);    cfg.trialdef.poststim = prepost(2);    cfg.trialfun = 'ft_trialfun_general';    cfg.trialdef.eventtype = 'Trigger';    cfg.trialdef.eventvalue = eventValues{evVal};    cfg = ft_definetrial(cfg);    data.(eventValues{evVal}) = ft_preprocessing(cfg);end

but I am getting exactly the same error...
Any suggestions of likely mistakes of my part/ problem with script would be most helpful.
Many thanks,
fieldtrip mailing list
fieldtrip at donders.ru.nl

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170216/676b7da2/attachment-0002.html>

More information about the fieldtrip mailing list