[FieldTrip] real-time events in fieldtrip

Little, Graham Graham.Little at nrc-cnrc.gc.ca
Mon Nov 21 14:31:50 CET 2011

Hi Khalid,

I was having similar issues with reading events in realtime from my MEG data.  To by pass this issue we wrote a short piece of code in Matlab to manually grab the event latencies from the Data using the Hdr.

alleventdata = ft_read_data(cfg.datafile, 'header', hdr, 'chanindx', stimindex, 'checkboundary', false);
allevent_delta = alleventdata - [0 alleventdata(1:end-1)];
allOnsets = find(allevent_delta==cfg.stimval);
totEvents = length(allOnsets);
fprintf(1,'Found %i events with value %i on %s in total\n',totEvents, cfg.stimval, cfg.stimchan);

-stimindex is the row of the data which contains the stimulus channel
-cfg.stimval is the value of the stimulus
-cfg.stimchan is the name of the stimulus channel

Hopefully that can work as a temporary solution for you. Not sure of the differences between Brain vision data format and MEG data but I'm assuming it should work the same.

From: fieldtrip-bounces at donders.ru.nl [fieldtrip-bounces at donders.ru.nl] On Behalf Of Abdullah Khalid [abdullah.khalid80 at yahoo.com]
Sent: Sunday, November 20, 2011 11:26 PM
To: fieldtrip at donders.ru.nl; Email discussion list for the FieldTrip project
Subject: Re: [FieldTrip] real-time events in fieldtrip

If anyone can help me please in reading events from Brain vision recorder.


From: Abdullah Khalid <abdullah.khalid80 at yahoo.com>
To: "fieldtrip at donders.ru.nl" <fieldtrip at donders.ru.nl>
Sent: Monday, November 21, 2011 10:47 AM
Subject: [FieldTrip] real-time events in fieldtrip

hi everyone

I am using Fieldtrip for realtime P300 classification.
i am facing one problem that i am unable to read Events (stimulus markers from Vision recorder)

my flashing program is in Visual c, that communicates with vision recorder and markers are displayed correctly in VisionRec.
while reading from buffer i get data correctly but it doesn't gives me events.

the command

event = read_event(cfg.dataset, 'minsample', prevSample+1);

gives me an empty vector.

I am using FT_REALTIME_BRAINAMPPROXY to read from Vision recorder.
with default setting i.e

cfg.port=51244;cfg.target.datafile      = 'buffer://localhost:1972'
cfg.target.eventfile     = 'buffer://localhost:1972'

after that if i use ft_realtime_signalviewer it displays data correctly but it shows no event.

fieldtrip mailing list
fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>

More information about the fieldtrip mailing list