<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Dear all,<div>I have a problem using the ft_read_event function. I am trying to read events from MEG data in a .fif file (306-channel Vectorview system, Elekta Neuromag, Helsinki, Finland). I am interested in the STI101 channel which is described as 'digital trigger' in the header. Unfortunately, the value field of the output is different than expected (I read the file in Python using the MNE library and I get correct results).</div><div><br></div><div>I noticed that in line 1463 of the ft_read_event function binaryindx is found as 'digital trigger' in channel type, but later read_trigger function is called (line 1473), which looks for 'binary trigger' in channel type (line 139 of read_triger function). If I stop the code before line 139 in read_trigger function, change the type of the channel STI101 into 'binary trigger' from 'digital trigger' and continue, I get correct results.</div><div><br></div><div>I would like to ask if my change makes sense and what can be the cause of the wrong value field of the output without the change.</div><div><br></div><div>Thank you for your help and best wishes,</div><div>Justyna Gula</div><div><br></div><div>%%</div><div>I call the function:</div><div>events= ft_read_event(filename,'type','STI101');<br></div><div><br></div><div>Part of the ft_read_event function:</div><div><div><br></div><div>analogindx = find(strcmp(ft_chantype(hdr), 'analog trigger'));</div><div>otherindx  = find(strcmp(ft_chantype(hdr), 'other trigger'));</div><div>binaryindx = find(strcmp(ft_chantype(hdr), 'digital trigger'));</div></div><div><br></div><div>and later:</div><div><br></div><div><div>if ~isempty(binaryindx)</div><div>        trigger = read_trigger(filename, 'header', hdr, 'dataformat', dataformat, 'begsample', flt_minsample, 'endsample', flt_maxsample, 'chanindx', binaryindx, 'detectflank', detectflank, 'trigshift', trigshift, 'fixneuromag', false);</div><div>        event   = appendevent(event, trigger);</div><div> end</div></div><div><br></div><div>Part of the read_trigger function:</div><div><div><br></div><div>switch hdr.chantype{chanindx(1)}</div><div>      case 'binary trigger'</div><div>        if any(dat(k,:)<0)</div><div>          dat(k,:) = double(typecast(int16(dat(k,:)), 'uint16'));</div><div>        end</div><div>      case 'analog trigger'</div><div>        % keep it as it is</div><div>      case 'other trigger'</div><div>        % keep it as it is</div></div><div><br></div></div></div></div></div></div></div></div>