[FieldTrip] Bug in ft_trialfun_brainvision_segmented.m

Daniel Matthes dmatthes at cbs.mpg.de
Fri Mar 17 13:35:10 CET 2017

Hi fieldtrip developers,

I found a bug in fieldtrip/trialfun/ft_trialfun_brainvision_segmented.m. 
If the Brain Vision marker file *.vmrk includes no 'Stimulus' makers, 
the ft_trialfun_brainvision_segmented function crashes in line 116. The 
reason for this crash is absence of the trialinfo variable.

In detail, if no 'Stimulus' is defined the numstim variable gets 0 (line 
99), otherwise the query 'if all(numstim==numstim(1))' in line 100 
results in true.

I would recommend to change line 100 to:

if ((numstim > 0 ) && (all(numstim==numstim(1))))

Hereby the else branch will be executed, if numstim = 0.

Furthermore, the mentioned function also crashes, if the stimulus 
markers in the marker file either have no value or a value with wrong 
letters. This cases should be captured with a more obvious error message.

All the best,


More information about the fieldtrip mailing list