BrainStreamMarkerSequence

From TSG Doc
Revision as of 09:07, 26 September 2018 by Wiki-admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Marker Sequences

It is possible to temporarily treat markers as data. This is useful when the markers in the sequence have a certain meaning. For example, over a period of time, an output device might inject a marker every time it changes the direction in which it is moving. By specifying a marker sequence, the values of the markers that are sent by the output device are placed in a field in the event structure, where you can access them for further processing.

In the marker column of the Actions table, you can specify a marker sequence according to the following syntax:

[<marker name> <number>?<name of parameter>;<timeout>]

marker name: name of the marker starting the sequence
number: number of markers to be collected for this parameter (if no number is specified, one marker will be collected)
? or * : indicates a fixed (?) or unknown ( * ) number of markers to be collected. In case of * , the next item specifies the name of the marker that ends the sequence.
name of parameter: this name will be added as field to the event structure, which will contain a string cell-array with the marker values. Parameters cannot have the same name as any of the global variables.
timeout: the maximum time to treat incoming markers as part of the sequence
Note that the entire sequence must be enclosed in brackets.

Example of a marker sequence for collecting data about the position of an output device:

marker
time
function
[start_seq ?x_coordinate ?y_coordinate; 0.1] MRKSEQ update_map
TIMEOUT stop_moving

An incoming marker start_seq starts the marker sequence. The next 2 markers will be processed as data for the parameters x_coordinate and y_coordinate. This means that two fields event.x_coordinate and event.y_coordinate will be created, each containing a each cell with the value of the collected marker. For example, the event fields may look like this: event.x_coordinate={2}, event.y_coordinate={3}. If the two markers have been collected within 100 ms after the onset of the start_sequence marker, the function update_map will be executed, which draws a map of the output device's trajectory. If the markers have not been collected within 100 ms, the function specified after TIMEOUT will be executed, which causes the output device to stop moving.

Some other examples of marker sequences:

marker
time
function
[mrk1 ?parm1 ?parm2 ;0.05] MRKSEQ fnc1,fnc2
TIMEOUT fnc3
[mrk2 5?parm3 ?parm4 7?parm5 ;0.099] MRKSEQ fnc4
TIMEOUT fnc3
[mrk3 *parm6 mrk4 ;0.11] MRKSEQ fnc5
TIMEOUT fnc3

An incoming marker mrk1 starts the marker sequence. The next two markers will be processed as data for parm1 (one marker) and parm2 (one marker). The fields parm1 and parm2 wil be added to the event structure of marker mrk1. That is, the event structure will contain the fields event.parm1={val1} and event.parm2={val1}. When all markers of the sequence have been collected, functions fnc1 and fnc2 will be executed. If the two markers do not arrive within 0.05 seconds after onset of marker mrk1, function fnc3 will be executed.

Incoming marker mrk2 starts another marker sequence. Here, the next thirteen markers will be processed as data for parm3 (5 markers), parm4 (1 marker), and parm5 (7 markers). Thus, the event structure will contain the fields event.parm3={val1,val2,val3,val4,val5}, event.parm4={val1}, and event.parm5={val1,val2,val3,val4,val5,val6,val7}. When all markers of the sequence have been collected, function fnc4 will be executed. If the thirteen markers do not arrive within 0.099 seconds after onset of marker mrk2, function fnc3 will be executed.

Incoming marker mrk3 starts a third marker sequence. An unknown number of markers will be processed as data for parm6 until marker mrk4 ends the sequence. Thus, the event structure will contain the field event.parm6={val1,val2,...,valN}. When all markers of the sequence have been collected, function fnc5 will be executed. If marker mrk4 does not arrive within 0.11 seconds after onset of marker mrk3, function fnc3 will be executed.