<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial,helvetica,sans-serif;font-size:10pt">Hi Dear,<br><br>Jan had a good idea... it seems that .edf files are not good to be read automatically for a trigger channel... but writing a simple function on my own I found some error (of course...):<br><br>evaluating trialfunction 'fun2'<br>error opening file: pippo.edf<br>??? One or more output arguments not assigned during call to "read_16bit".<br><br>Error in ==> read_edf>readLowLevel at 374<br> buf = read_16bit(filename, offset, numwords);<br>
<br>Error in ==> read_edf at 334<br> buf = readLowLevel(filename, offset, epochlength); % see below in subfunction<br><br>Error in ==> ft_read_data at 562<br> dat = read_edf(filename, hdr, begsample, endsample, chanindx);<br>
<br>Error in ==> fun2 at 13<br>trg = ft_read_data(cfg.datafile, 'header', hdr, ...<br><br>Error in ==> ft_definetrial at 123<br> trl = feval(cfg.trialfun, cfg);<br><br>Error in ==> program1 at 11<br>
cfg = ft_definetrial(cfg);<br><br><br>have anyone some ideas about it ?<br>Ivano<br><br>--------------------------------------------------------------------------------<br><br>Dear Ivano,<br><br>I would first check what 'triggers' fieldtrip automatically detects <br>from your data. As far as I am aware, there is no default reading of a <br>'trigger' channel for .edf data, but I am not sure.<br><br>You can get an idea bout the event-info, by specifying<br><br>cfg = [];<br>cfg.dataset = ...<br>cfg.trialdef.eventtyp = '?';<br>ft_definetrial(cfg);<br><br>This outputs some info to your screen, about which events are in the <br>data. Each event is of a certain type 'type' , and may have a value <br>'value', e.g. when the acquisition system has an explicit trigger <br>channel to which your stimulus presentation program, or response <br>device sends discrete trigger pulses of varying height.<br><br>In your case, I suspect that
something else needs to be done (in case <br>definetrial does not show triggers related to your trigger channel), <br>i.e. you need to write your own 'trialfun'. Rather than using <br>cfg.trialdef.eventtype/eventvalue, you need to specify cfg.trialfun = <br>'ivanoscooltrialfun', and you need to write your own file: <br>trialfun_ivanoscooltrialfun which defines your segments of interest <br>based on some feature in your trigger channel. Here's an example which <br>uses an EMG-channel as epoch-defining signal. Of course your trigger <br>channel needs to be processed in a different way but at least it gives <br>you an impression.<br><br><a href="http://fieldtrip.fcdonders.nl/example/detect_the_muscle_activity_in_an_emg_channel_and_use_that_as_trial_definition?s" target="_blank">http://fieldtrip.fcdonders.nl/example/detect_the_muscle_activity_in_an_emg_channel_and_use_that_as_trial_definition?s</a>
<br>[]=trialfun<br><br>Good luck<br><br>Jan-Mathijs<br></div><br>
</body></html>