[FieldTrip] cfg.trialfun in realtime functions

Stephen Whitmarsh stephen.whitmarsh at gmail.com
Thu May 10 15:07:34 CEST 2012

Hi Hamza,

I just saw you've been posting on the FT list for quite a while and
have been working on offline analysis already. To answer your question
more specifically: The trialfunction could be very simple in the first
instance, but is needed to know what samples to read when
preprocessing the data. You can find some examples here that you can
adapt to your own purpose here:


On 10 May 2012 14:51, Stephen Whitmarsh <stephen.whitmarsh at gmail.com> wrote:
> Dear Hamza,
> The trialfunction is an integral part of processing data in FieldTrip.
> It is how you define your timepoints of interest, i.e. trials based on
> recorded markers in your data, or based on user-defined events (e.g.
> sleep stages).
> If you are not yet familiar with the basic FieldTrip operations the
> documentation of the realtime analysis  might indeed seem somewhat
> inadequate as it assumes this familiarity. FieldTrip's online analysis
> tools are using many of the same functions of the offline ones, and
> has a similar overall philosophy and approach. This makes it
> relatively easy to understand and to use online analysis approach once
> one is familiar with the offline one. Alas this translation is
> assymmetric and doesn't hold for the other way around.
> The good news is, however, that everything is there to get you on your
> way once your take a little detour. You could take a look at the
> tutorial documentation (http://fieldtrip.fcdonders.nl/tutorial) and
> get a bit of hands-on working through some steps with the supplied
> tutorial-data.
> Specifically for your question these pages would be relevant:
> http://fieldtrip.fcdonders.nl/example/getting_started_with_reading_raw_eeg_or_meg_data
> http://fieldtrip.fcdonders.nl/tutorial/preprocessing
> http://fieldtrip.fcdonders.nl/tutorial/continuous
> For more overview and general operations I would advice reading through:
> http://fieldtrip.fcdonders.nl/walkthrough
> Most of all it might not be a bad idea to start with a pre-recorded
> dataset and work on it offline, using the more standard and more
> extensively documented offline functions for e.g. trial based
> averaging. Once that works out for you can adapt it to the realtime
> situation.
> Hope this helps,
> Stephen
> On 10 May 2012 13:55, Hamza Fawzi Altakroury (Student)
> <hamzaf at sabanciuniv.edu> wrote:
>> Hello,
>> I don't know why should I define a function inside the
>> ft_realtime_selectiveaverage.
>> I just want to make an average of some segments.
>> Could you provide me with an example of cfg.trialfun
>> Hamza
>> On Wed, May 9, 2012 at 11:33 AM, Hamza Fawzi Altakroury (Student)
>> <hamzaf at sabanciuniv.edu> wrote:
>>> Hello,
>>> I am doing realtime processing, and I wanted to check ft_realtime_average
>>> function and ft_realtime_selectiveaverage functions.
>>> I faced a problem in defining cfg.trialfun
>>> Could you help me
>>> Best
>>> --
>>> Hamza Fawzi Altakroury
>>> Graduate student - MA
>>> Faculty of Engineering and Natural Sciences
>>> Sabancı University
>> --
>> Hamza Fawzi Altakroury
>> Graduate student - MA
>> Faculty of Engineering and Natural Sciences
>> Sabancı University
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

More information about the fieldtrip mailing list